CheckStyle:Checks之标准Checks

标准Checks

标准Checkstyle Checks适用于常规Java编码样式,并且不需要外部库。
Checkstyle提供了许多可应用于源代码的检查。以下是按字母顺序排列的参考。

Checkers 描述
AbbreviationAsWordInName The Check validate abbreviations(consecutive capital letters) length in identifier name, it also allow in enforce camel case naming. Check会在标识符名称中验证缩写(连续的大写字母)的长度,还允许在强制驼峰式命名中使用。
AbstractClassName Ensures that the names of abstract classes conforming to some regular expression and check that abstract modifier exists. 确保抽象类的名称符合某些正则表达式,并检查abstract修饰符是否存在。
AnnotationLocation Check location of annotation on language elements. 检查语言元素上注释的位置。
AnnotationOnSameLine The check does verifying that annotations are located on the same line with their targets. 该检查确实会验证注释与其目标位于同一行。
AnnotationUseStyle This check controls the style with the usage of annotations. 此检查通过使用注释来控制样式。
AnonInnerLength Checks for long anonymous inner classes. 检查长的匿名内部类。
ArrayTrailingComma Checks if array initialization contains optional trailing comma. 检查数组初始化是否包含可选的结尾逗号。
ArrayTypeStyle Checks the style of array type definitions. 检查数组类型定义的样式。
AtclauseOrder Checks the order of at-clauses. 检查子句的顺序。
AvoidEscapedUnicodeCharacters Restrict using Unicode escapes. 限制使用Unicode转义。
AvoidInlineConditionals Detects inline conditionals. 检测内联条件。
AvoidNestedBlocks Finds nested blocks. 查找嵌套块。
AvoidStarImport Check that finds import statements that use the * notation. 检查以查找使用*符号的导入语句。
AvoidStaticImport Check that finds static imports. 检查找到静态导入。
BooleanExpressionComplexity Restricts nested boolean operators (&&, ||, &, | and ^) to a specified depth (default = 3). 将嵌套的布尔运算符(&&,||,&,|和^)限制为指定的深度(默认= 3)。
CatchParameterName Checks that catch parameter names conform to a format specified by the format property. 检查catch参数名称是否符合format属性指定的格式。
ClassDataAbstractionCoupling This metric measures the number of instantiations of other classes within the given class. 此度量标准度量给定类中其他类的实例化数量。
ClassFanOutComplexity The number of other classes a given class relies on. 给定类所依赖的其他类的数量。
ClassMemberImpliedModifier Checks for implicit modifiers on class members and nested types. 检查类成员和嵌套类型上的隐式修饰符。
ClassTypeParameterName Checks that class type parameter names conform to a format specified by the format property. 检查类类型参数名称是否符合format属性指定的格式。
CommentsIndentation Controls the indentation between comments and surrounding code. 控制注释和周围代码之间的缩进。
ConstantName Checks that constant names conform to a format specified by the format property. 检查常量名称是否符合format属性指定的格式。
CovariantEquals Checks that if a class defines a covariant method equals, then it defines method equals(java.lang.Object). 检查是否一个类定义了一个等于的协变方法,然后它定义了方法equals(java.lang.Object)。
CustomImportOrder Checks that the groups of import declarations appear in the order specified by the user. 检查导入声明组是否按用户指定的顺序显示。
CyclomaticComplexity Checks cyclomatic complexity against a specified limit. 根据指定的限制检查圈复杂度。
DeclarationOrder Checks that the parts of a class or interface declaration appear in the order suggested by the Code Conventions for the Java Programming Language. 检查类或接口声明的部分是否以Java编程语言的代码约定建议的顺序出现。
DefaultComesLast Check that the default is after all the cases in a switch statement. 在switch语句中检查所有情况后的默认值。
DescendantToken Checks for restricted tokens beneath other tokens. 检查其他令牌下方的受限令牌。
DesignForExtension Checks that classes are designed for inheritance. 检查类是否为继承而设计。
EmptyBlock Checks for empty blocks but does not validate sequential blocks. 检查空块,但不验证顺序块。
EmptyCatchBlock Checks for empty catch blocks with few options to skip violation. 检查空的捕获块,几乎没有跳过冲突的选项。
EmptyForInitializerPad Checks the padding of an empty for initializer; that is whether a space is required at an empty for initializer, or such spaces are forbidden. 检查用于初始值设定项的空白填充;这就是说初始化程序的空白处是否需要一个空格,还是禁止使用这些空格。
EmptyForIteratorPad Checks the padding of an empty for iterator; that is whether a space is required at an empty for iterator, or such spaces are forbidden. 检查空白是否为迭代器;这就是说迭代器的空白处是否需要一个空格,还是禁止使用此类空格。
EmptyLineSeparator Checks for blank line separators. 检查空白行分隔符。
EmptyStatement Detects empty statements (standalone ‘;’). 检测空语句(独立的“;”)。
EqualsAvoidNull Checks that any combination of String literals is on the left side of an equals() comparison. 检查String文字的任何组合是否在equals()比较的左侧。
EqualsHashCode Checks that classes that override equals() also override hashCode(). 检查覆盖equals()的类是否也覆盖hashCode()。
ExecutableStatementCount Restricts the number of executable statements to a specified limit (default = 30). 将可执行语句的数量限制为指定的限制(默认值= 30)。
ExplicitInitialization Checks if any class or object member explicitly initialized to default for its type value (null for object references, zero for numeric types and char and false for boolean. 检查是否有任何类或对象成员的类型值显式初始化为默认值(对象引用为null,数字类型为零,char为布尔值,布尔值为false。
FallThrough Checks for fall through in switch statements Finds locations where a case contains Java code - but lacks a break, return, throw or continue statement. 检查switch语句中的失败找到包含Java代码的案例,但是缺少break,return,throw或Continue语句的位置。
FileLength Checks for long source files. 检查长源文件。
FileTabCharacter Checks to see if a file contains a tab character. 检查文件是否包含制表符。
FinalClass Checks that class which has only private constructors is declared as final. 检查只有私有构造函数的类被声明为final。
FinalLocalVariable Ensures that local variables that never get their values changed, must be declared final. 确保永不更改其值的局部变量必须声明为final。
FinalParameters Check that method/constructor/catch/foreach parameters are final. 检查method / constructor / catch / foreach参数是否为最终参数。
GenericWhitespace Checks that the whitespace around the Generic tokens < and > are correct to the typical convention. 检查通用标记<和>周围的空格是否与典型约定正确。
Header Checks the header of the source against a fixed header file. 根据固定的头文件检查源头。
HiddenField Checks that a local variable or a parameter does not shadow a field that is defined in the same class. 检查局部变量或参数是否不遮盖同一类中定义的字段。
HideUtilityClassConstructor Make sure that utility classes (classes that contain only static methods) do not have a public constructor. 确保实用程序类(仅包含静态方法的类)没有公共构造函数。
IllegalCatch Catching java.lang.Exception, java.lang.Error or java.lang.RuntimeException is almost never acceptable. 捕获java.lang.Exception,java.lang.Error或java.lang.RuntimeException几乎是不可接受的。
IllegalImport Checks for imports from a set of illegal packages. 检查一组非法包装的进口。
IllegalInstantiation Checks for illegal instantiations where a factory method is preferred. 检查首选工厂方法的非法实例。
IllegalThrows Throwing java.lang.Error or java.lang.RuntimeException is almost never acceptable. 几乎永远不会抛出java.lang.Error或java.lang.RuntimeException。
IllegalToken Checks for illegal tokens. 检查非法令牌。
IllegalTokenText Checks for illegal token text. 检查非法令牌文本。
IllegalType Checks that particular classes or interfaces are never used. 检查是否从未使用过特定的类或接口。
ImportControl Check that controls what can be imported in each package and file. 检查控件是否可以导入每个包和文件中。
ImportOrder Ensures that groups of imports come in a specific order. 确保进口组按特定顺序进货。
Indentation Checks correct indentation of Java Code. 检查Java代码的正确缩进。
InnerAssignment Checks for assignments in subexpressions, such as in String s = Integer.toString(i = 2);. 检查子表达式中的赋值,例如String s = Integer.toString(i = 2);。
InnerTypeLast Check nested (internal) classes/interfaces are declared at the bottom of the class after all method and field declarations. 在所有方法和字段声明之后,检查嵌套(内部)类/接口是否在类的底部声明。
InterfaceIsType Implements Bloch, Effective Java, Item 17 - Use Interfaces only to define types. 实现Bloch,有效Java,条款17-仅使用接口定义类型。
InterfaceMemberImpliedModifier Checks for implicit modifiers on interface members and nested types. 检查接口成员和嵌套类型上的隐式修饰符。
InterfaceTypeParameterName Checks that interface type parameter names conform to a format specified by the format property. 检查接口类型参数名称是否符合format属性指定的格式。
InvalidJavadocPosition Checks that Javadocs are located at the correct position. 检查Javadocs是否位于正确的位置。
JavadocBlockTagLocation Checks that a javadoc block tag appears only at the beginning of a line. 检查javadoc块标记是否仅出现在行的开头。
JavadocMethod Checks the Javadoc of a method or constructor. 检查方法或构造函数的Javadoc。
JavadocPackage Checks that all packages have a package documentation. 检查所有软件包是否都具有软件包文档。
JavadocParagraph Checks Javadoc paragraphs. 检查Javadoc段落。
JavadocStyle Custom Checkstyle Check to validate Javadoc. 自定义Checkstyle检查以验证Javadoc。
JavadocTagContinuationIndentation Checks the indentation of the continuation lines in at-clauses. 检查子句中连续线的缩进。
JavadocType Checks the Javadoc of a type. 检查类型的Javadoc。
JavadocVariable Checks that a variable has Javadoc comment. 检查变量是否具有Javadoc注释。
JavaNCSS This check calculates the Non Commenting Source Statements (NCSS) metric for Java source files and methods. 此检查将计算Java源文件和方法的“非注释源语句(NCSS)”度量标准。
LambdaParameterName Check to verify lambda parameter names. 检查以验证lambda参数名称。
LeftCurly Checks the placement of left curly braces on types, methods and other blocks: 检查左花括号在类型,方法和其他块上的位置:
LineLength Checks for long lines. 检查长行。
LocalFinalVariableName Checks that local final variable names conform to a format specified by the format property. 检查本地最终变量名称是否符合format属性指定的格式。
LocalVariableName Checks that local, non-final variable names conform to a format specified by the format property. 检查本地非最终变量名称是否符合format属性指定的格式。
MagicNumber Checks for magic numbers. 检查幻数。
MemberName Checks that instance variable names conform to a format specified by the format property. 检查实例变量名称是否符合format属性指定的格式。
MethodCount Checks the number of methods declared in each type declaration by access modifier or total count. 通过访问修饰符或总数检查每个类型声明中声明的方法的数量。
MethodLength Checks for long methods. 检查长方法。
MethodName Checks that method names conform to a format specified by the format property. 检查方法名称是否符合format属性指定的格式。
MethodParamPad Checks the padding between the identifier of a method definition, constructor definition, method call, or constructor invocation; and the left parenthesis of the parameter list. 检查方法定义的标识符,构造函数定义,方法调用或构造函数调用之间的填充;和参数列表的左括号。
MethodTypeParameterName Checks that class type parameter names conform to a format specified by the format property. 检查类类型参数名称是否符合format属性指定的格式。
MissingCtor Checks that classes (except abstract one) define a ctor and don’t rely on the default one. 检查类(抽象类除外)是否定义了ctor,并且不依赖默认类。
MissingDeprecated This class is used to verify that both the java.lang.Deprecated annotation is present and the @deprecated Javadoc tag is present when either is present. 此类用于验证同时存在java.lang.Deprecated注释和存在@deprecated Javadoc标记。
MissingJavadocMethod Checks for missing Javadoc comments for a method or constructor. 检查方法或构造函数的Javadoc注释是否丢失。
MissingJavadocPackage Checks for missing Javadoc comments in package-info.java files. 检查package-info.java文件中是否缺少Javadoc注释。
MissingJavadocType Checks for missing Javadoc comments for class, enum, interface, and annotation interface definitions. 检查有关类,枚举,接口和注释接口定义的缺少Javadoc注释。
MissingOverride This class is used to verify that the java.lang.Override annotation is present when the {@inheritDoc} javadoc tag is present. 当存在{@inheritDoc} javadoc标记时,此类用于验证是否存在java.lang.Override批注。
MissingSwitchDefault Checks that switch statement has “default” clause. 检查switch语句是否具有“ default”子句。
ModifiedControlVariable Check for ensuring that for loop control variables are not modified inside the for block. 检查以确保未在for块内修改for循环控制变量。
ModifierOrder Checks that the order of modifiers conforms to the suggestions in the Java Language specification, sections 8.1.1, 8.3.1 and 8.4.3. 检查修饰符的顺序是否符合 Java语言规范中的建议 8.1.1、8.3.1和8.4.3。
MultipleStringLiterals Checks for multiple occurrences of the same string literal within a single file. 检查单个文件中是否多次出现同一字符串文字。
MultipleVariableDeclarations Checks that each variable declaration is in its own statement and on its own line. 检查每个变量声明是否在其自己的语句中和自己的行中。
MutableException Ensures that exceptions (defined as any class name conforming to some regular expression) are immutable. 确保异常(定义为符合某些正则表达式的任何类名)是不可变的。
NeedBraces Checks for braces around code blocks. 检查代码块周围的花括号。
NestedForDepth Restricts nested for blocks to a specified depth (default = 1). 将嵌套块限制为指定深度(默认值= 1)。
NestedIfDepth Restricts nested if-else blocks to a specified depth (default = 1). 将嵌套的if-else块限制为指定的深度(默认值= 1)。
NestedTryDepth Restricts nested try-catch-finally blocks to a specified depth (default = 1). 将嵌套的try-catch-finally块限制为指定的深度(默认= 1)。
NewlineAtEndOfFile Checks that there is a newline at the end of each file. 检查每个文件末尾是否有换行符。
NoClone Checks that the clone method is not overridden from the Object class. 检查是否从Object类覆盖了clone方法。
NoFinalizer Checks that no method having zero parameters is defined using the name finalize. 检查是否没有使用名称finalize定义具有零参数的方法。
NoLineWrap Checks that chosen statements are not line-wrapped. 检查所选语句是否未换行。
NonEmptyAtclauseDescription Checks that the at-clause tag is followed by description . 检查从句标签后面是否有description。
NoWhitespaceAfter Checks that there is no whitespace after a token. 检查令牌后是否没有空格。
NoWhitespaceBefore Checks that there is no whitespace before a token. 检查令牌前是否没有空格。
NPathComplexity Checks the npath complexity against a specified limit (default = 200). 根据指定的限制检查npath复杂度(默认= 200)。
OneStatementPerLine Checks that there is only one statement per line. 检查每行只有一条语句。
OneTopLevelClass Checks that each top-level class, interfaces or enum resides in a source file of its own. 检查每个顶级类,接口或枚举是否驻留在其自己的源文件中。
OperatorWrap Checks line wrapping for operators. 检查换行符是否为运算符。
OrderedProperties Detects if keys in properties files are in correct order. 检测属性文件中的键是否顺序正确。
OuterTypeFilename Checks that the outer type name and the file name match. 检查外部类型名称和文件名是否匹配。
OuterTypeNumber Checks for the number of defined types at the “outer” level. 在“外部”级别检查已定义类型的数量。
OverloadMethodsDeclarationOrder Checks that overload methods are grouped together. 检查重载方法是否组合在一起。
PackageAnnotation This check makes sure that all package annotations are in the package-info.java file. 此检查确保所有软件包注释都在package-info.java文件中。
PackageDeclaration Ensures there is a package declaration and (optionally) in the correct directory. 确保在正确的目录中有一个包声明和(可选)。
PackageName Checks that package names conform to a format specified by the format property. 检查软件包名称是否符合format属性指定的格式。
ParameterAssignment Disallow assignment of parameters. 禁止分配参数。
ParameterName Checks that parameter names conform to a format specified by the format property. 检查参数名称是否符合format属性指定的格式。
ParameterNumber Checks the number of parameters that a method or constructor has. 检查方法或构造函数具有的参数数量。
ParenPad Checks the padding of parentheses; that is whether a space is required after a left parenthesis and before a right parenthesis, or such spaces are forbidden, with the exception that it does not check for padding of the right parenthesis at an empty for iterator. 检查括号的填充;也就是说,是在左括号之后还是在右括号之前是否需要一个空格,或者是这样的空格,除非它不检查迭代器的空白处是否填充了右括号。
RedundantImport Checks for imports that are redundant. 检查是否有多余的导入。
RedundantModifier Checks for redundant modifiers in interface and annotation definitions, final modifier on methods of final classes, inner interface declarations that are declared as static, non public class constructors and enum constructors, nested enum definitions that are declared as static. 检查接口和批注定义中的冗余修饰符,最终类方法上的最终修饰符,声明为静态的内部接口声明,非公共类构造函数和枚举构造函数,嵌套的枚举定义为静态的枚举。
Regexp A check that makes sure that a specified pattern exists (or not) in the file. 检查以确保文件中存在(或不存在)指定的模式。
RegexpHeader Checks the header of the source against a header file that contains a 根据包含以下内容的头文件检查源头
RegexpMultiline Implementation of a check that looks that matches across multiple lines in any file type. 看起来与任何文件类型中的多行都匹配的检查的实现。
RegexpOnFilename Implementation of a check that matches based on file and/or folder path. 实现基于文件和/或文件夹路径匹配的检查。
RegexpSingleline Implementation of a check that looks for a single line in any file type. 查找任何文件类型中的单行的检查的实现。
RegexpSinglelineJava Implementation of a check that looks for a single line in Java files. 在Java文件中查找单行的检查的实现。
RequireThis Checks that code doesn’t rely on the “this” default. 检查代码是否不依赖于“ this”默认值。
ReturnCount Restricts return statements to a specified count (default = 2). 将return语句限制为指定的计数(默认= 2)。
RightCurly Checks the placement of right curly braces. 检查右花括号的位置。
SeparatorWrap Checks line wrapping with separators. 检查带有分隔符的换行。
SimplifyBooleanExpression Checks for overly complicated boolean expressions. 检查过于复杂的布尔表达式。
SimplifyBooleanReturn Checks for overly complicated boolean return statements. 检查过于复杂的布尔返回语句。
SingleLineJavadoc Checks that a JavaDoc block which can fit on a single line and doesn’t contain at-clauses 检查一个JavaDoc块是否可以放在一行上并且不包含子句
SingleSpaceSeparator Checks that non-whitespace characters are separated by no more than one whitespace. 检查非空格字符之间是否被不超过一个空格分隔。
StaticVariableName Checks that static, non-final variable names conform to a format specified by the format property. 检查静态非最终变量名称是否符合format属性指定的格式。
StringLiteralEquality Checks that string literals are not used with == or !=. 检查字符串文字是否不与==或!=一起使用。
SummaryJavadoc Checks that Javadoc summary sentence does not contain phrases that are not recommended to use. 检查Javadoc摘要语句是否不包含不建议使用的短语。
SuperClone Checks that an overriding clone() method invokes super.clone(). 检查重写的clone()方法是否调用super.clone()。
SuperFinalize Checks that an overriding finalize() method invokes super.finalize(). 检查覆盖的finalize()方法是否调用super.finalize()。
SuppressWarnings This check allows you to specify what warnings that 此检查使您可以指定哪些警告
ThrowsCount Restricts throws statements to a specified count (default = 4). 将throws语句限制为指定的计数(默认值= 4)。
TodoComment A check for TODO comments. 检查TODO注释。
TrailingComment The check to ensure that requires that comments be the only thing on a line. 检查以确保要求注释是一行中唯一的内容。
Translation The TranslationCheck class helps to ensure the correct translation of code by checking property files for consistency regarding their keys. TranslationCheck类通过检查属性文件有关其键的一致性来帮助确保代码的正确翻译。
TypecastParenPad Checks the padding of parentheses for typecasts. 检查括号中是否有类型转换。
TypeName Checks that type names conform to a format specified by the format property. 检查类型名称是否符合format属性指定的格式。
UncommentedMain Detects uncommented main methods. 检测未注释的主要方法。
UniqueProperties Detects duplicated keys in properties files. 检测属性文件中的重复键。
UnnecessaryParentheses Checks if unnecessary parentheses are used in a statement or expression. 检查语句或表达式中是否使用了不必要的括号。
UnnecessarySemicolonInEnumeration Checks if unnecessary semicolon is in enum definitions. 检查枚举定义中是否包含不必要的分号。
UnnecessarySemicolonInTryWithResources Checks if unnecessary semicolon is used in last resource declaration. 检查在上一个资源声明中是否使用了不必要的分号。
UnnecessarySemicolonAfterTypeMemberDeclaration Checks if unnecessary semicolon is used after type member declaration. 检查类型成员声明后是否使用了不必要的分号。
UnusedImports Checks for unused import statements. 检查未使用的导入语句。
UpperEll Checks that long constants are defined with an upper ell. 检查长常量是否使用上限ell定义。
VariableDeclarationUsageDistance Checks the distance between declaration of variable and its first usage. 检查变量声明与其首次使用之间的距离。
VisibilityModifier Checks visibility of class members. 检查班级成员的可见性。
WhitespaceAfter Checks that a token is followed by whitespace, with the exception that it does not check for whitespace after the semicolon of an empty for iterator. 检查令牌后面是否有空格,但不检查迭代器的空分号后是否有空格。
WhitespaceAround Checks that a token is surrounded by whitespace. 检查令牌是否被空白包围。
WriteTag Outputs a JavaDoc tag as information. 输出JavaDoc标记作为信息。

Holder Checks

这些检查不是正常的检查,通常与专门的过滤器相关联,以收集过滤器自身无法获得的信息。

禁止警告持有人 维护来自SuppressWarnings批注的一组检查抑制。

你可能感兴趣的:(CheckStyle)