Checkstyle provides many checks that you can apply to your sourcecode. Below is an alphabetical reference, the site navigation menu provides a reference organized by functionality.
| AbstractClassName | Ensures that the names of abstract classes conforming to some regular expression. |
| AbstractClassName | Ensures that the names of abstract classes conforming to some regular expression. |
| AnonInnerLength | Checks for long anonymous inner classes. |
| AnonInnerLength | Checks for long anonymous inner classes. |
| ArrayTrailingComma | Checks if array initialization contains optional trailing comma. |
| ArrayTrailingComma | Checks if array initialization contains optional trailing comma. |
| ArrayTypeStyle | Checks the style of array type definitions. |
| ArrayTypeStyle | Checks the style of array type definitions. |
| AvoidInlineConditionals | Detects inline conditionals. |
| AvoidInlineConditionals | Detects inline conditionals. |
| AvoidNestedBlocks | Finds nested blocks. |
| AvoidNestedBlocks | Finds nested blocks. |
| AvoidStarImport | Check that finds import statements that use the * notation. |
| AvoidStarImport | Check that finds import statements that use the * notation. |
| AvoidStaticImport | Check that finds static imports. |
| AvoidStaticImport | Check that finds static imports. |
| BooleanExpressionComplexity | Restricts nested boolean operators (&&, ||, &, | and ^) to a specified depth (default = 3). |
| BooleanExpressionComplexity | Restricts nested boolean operators (&&, ||, &, | and ^) to a specified depth (default = 3). |
| ClassDataAbstractionCoupling | This metric measures the number of instantiations of other classes within the given class. |
| 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. |
| ClassFanOutComplexity | The number of other classes a given class relies on. |
| ClassTypeParameterName | Checks that class type parameter names conform to a format specified by the format property. |
| ClassTypeParameterName | Checks that class type parameter names conform to a format specified by the format property. |
| ConstantName | Checks that constant names conform to a format specified by the format property. |
| ConstantName | Checks that constant names conform to a format specified by the format property. |
| CovariantEquals | Checks that if a class defines a covariant method equals, then it defines method equals(java.lang.Object). |
| CovariantEquals | Checks that if a class defines a covariant method equals, then it defines method equals(java.lang.Object). |
| CrossLanguageRegexpHeader | A FileSetCheck similar to |
| CrossLanguageRegexpHeader | A FileSetCheck similar to |
| CyclomaticComplexity | Checks cyclomatic complexity against a specified limit. |
| 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. |
| 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. |
| DefaultComesLast |
Check that the default is after all the cases
in a switch statement.
|
| DefaultComesLast |
Check that the default is after all the cases
in a switch statement.
|
| DescendantToken | Checks for restricted tokens beneath other tokens. |
| DescendantToken | Checks for restricted tokens beneath other tokens. |
| DesignForExtension | Checks that classes are designed for inheritance. |
| DesignForExtension | Checks that classes are designed for inheritance. |
| DoubleCheckedLocking | Detect the double-checked locking idiom, a technique that tries to avoid synchronization overhead but is incorrect because of subtle artifacts of the java memory model. |
| DoubleCheckedLocking | Detect the double-checked locking idiom, a technique that tries to avoid synchronization overhead but is incorrect because of subtle artifacts of the java memory model. |
| EmptyBlock | Checks for empty blocks. |
| EmptyBlock | Checks for empty blocks. |
| 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. |
| 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. |
| 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. |
| EmptyStatement | Detects empty statements (standalone ';'). |
| EmptyStatement | Detects empty statements (standalone ';'). |
| EqualsAvoidNull | Checks that any combination of String literals with optional assignment is on the left side of an equals() comparison. |
| EqualsAvoidNull | Checks that any combination of String literals with optional assignment is on the left side of an equals() comparison. |
| EqualsHashCode | Checks that classes that override equals() also override hashCode(). |
| EqualsHashCode | Checks that classes that override equals() also override hashCode(). |
| ExecutableStatementCount | Restricts the number of executable statements to a specified limit (default = 30). |
| ExecutableStatementCount | Restricts the number of executable statements to a specified limit (default = 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.
|
| 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.
|
| 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. |
| 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. |
| FileLength | Checks for long source files. |
| FileLength | Checks for long source files. |
| FinalClass | Checks that class which has only private ctors is declared as final. |
| FinalClass | Checks that class which has only private ctors is declared as final. |
| FinalLocalVariable | Ensures that local variables that never get their values changed, must be declared final. |
| FinalLocalVariable | Ensures that local variables that never get their values changed, must be declared final. |
| FinalParameters | Check that method/constructor/catch/foreach parameters are final. |
| FinalParameters | Check that method/constructor/catch/foreach parameters are final. |
| GenericIllegalRegexp | A generic check for code problems, the user can search for any pattern. |
| GenericIllegalRegexp | A generic check for code problems, the user can search for any pattern. |
| GenericWhitespace | Checks that the whitespace around the Generic tokens < and > are correct to the typical convention. |
| 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. |
| 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. |
| 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. |
| 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. |
| IllegalCatch | Catching java.lang.Exception, java.lang.Error or java.lang.RuntimeException is almost never acceptable. |
| IllegalImport | Checks for imports from a set of illegal packages. |
| IllegalImport | Checks for imports from a set of illegal packages. |
| IllegalInstantiation | Checks for illegal instantiations where a factory method is preferred. |
| IllegalInstantiation | Checks for illegal instantiations where a factory method is preferred. |
| IllegalThrows | Throwing java.lang.Error or java.lang.RuntimeException is almost never acceptable. |
| IllegalThrows | Throwing java.lang.Error or java.lang.RuntimeException is almost never acceptable. |
| IllegalToken | Checks for illegal tokens. |
| IllegalToken | Checks for illegal tokens. |
| IllegalTokenText | Checks for illegal token text. |
| IllegalTokenText | Checks for illegal token text. |
| IllegalType | Checks that particular class are never used as types in variable declarations, return values or parameters. |
| IllegalType | Checks that particular class are never used as types in variable declarations, return values or parameters. |
| ImportControl | Check that controls what packages can be imported in each package. |
| ImportControl | Check that controls what packages can be imported in each package. |
| ImportOrder | Class to check the ordering/grouping of imports. |
| ImportOrder | Class to check the ordering/grouping of imports. |
| Indentation | Checks correct indentation of Java Code. |
| Indentation | Checks correct indentation of Java Code. |
| InnerAssignment |
Checks for assignments in subexpressions, such as in
String s = Integer.toString(i = 2);.
|
| InnerAssignment |
Checks for assignments in subexpressions, such as in
String s = Integer.toString(i = 2);.
|
| InterfaceIsType | Implements Bloch, Effective Java, Item 17 - Use Interfaces only to define types. |
| InterfaceIsType | Implements Bloch, Effective Java, Item 17 - Use Interfaces only to define types. |
| JUnitTestCase | Ensures that the setUp(), tearDown()methods are named correctly, have no arguments, return void and are either public or protected. |
| JUnitTestCase | Ensures that the setUp(), tearDown()methods are named correctly, have no arguments, return void and are either public or protected. |
| JavaNCSS | This check calculates the Non Commenting Source Statements (NCSS) metric for java source files and methods. |
| JavaNCSS | This check calculates the Non Commenting Source Statements (NCSS) metric for java source files and methods. |
| JavadocMethod | Checks the Javadoc of a method or constructor. |
| JavadocMethod | Checks the Javadoc of a method or constructor. |
| JavadocPackage | Checks that all packages have a package documentation. |
| JavadocPackage | Checks that all packages have a package documentation. |
| JavadocStyle | Custom Checkstyle Check to validate Javadoc. |
| JavadocStyle | Custom Checkstyle Check to validate Javadoc. |
| JavadocType | Checks the Javadoc of a type. |
| JavadocType | Checks the Javadoc of a type. |
| JavadocVariable | Checks that a variable has Javadoc comment. |
| JavadocVariable | Checks that a variable has Javadoc comment. |
| LeftCurly | Checks the placement of left curly braces on types, methods and other blocks: |
| LeftCurly | Checks the placement of left curly braces on types, methods and other blocks: |
| LineLength | Checks for long lines. |
| LineLength | Checks for long lines. |
| LocalFinalVariableName | Checks that local final variable names conform to a format specified by the format property. |
| LocalFinalVariableName | Checks that local final variable names conform to a format specified by the format property. |
| LocalVariableName | Checks that local, non-final variable names conform to a format specified by the format property. |
| LocalVariableName | Checks that local, non-final variable names conform to a format specified by the format property. |
| MagicNumber | Checks for magic numbers. |
| MagicNumber | Checks for magic numbers. |
| MemberName | Checks that instance variable names conform to a format specified by the format property. |
| MemberName | Checks that instance variable names conform to a format specified by the format property. |
| MethodLength | Checks for long methods. |
| MethodLength | Checks for long methods. |
| MethodName | Checks that method names conform to a format specified by the format property. |
| MethodName | Checks that method names conform to a format specified by the format property. |
| 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. |
| 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. |
| MethodTypeParameterName | Checks that class type parameter names conform to a format specified by the format property. |
| MissingCtor | Checks that classes (except abstract one) define a ctor and don't rely on the default one. |
| MissingCtor | Checks that classes (except abstract one) define a ctor and don't rely on the default one. |
| MissingSwitchDefault | Checks that switch statement has "default" clause. |
| MissingSwitchDefault | Checks that switch statement has "default" clause. |
| ModifiedControlVariable | Check for ensuring that for loop control variables are not modified inside the for block. |
| ModifiedControlVariable | Check for ensuring that for loop control variables are not modified inside the for block. |
| 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. |
| 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. |
| MultipleStringLiterals | Checks for multiple occurrences of the same string literal within a single file. |
| 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. |
| 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. |
| MutableException | Ensures that exceptions (defined as any class name conforming to some regular expression) are immutable. |
| NPathComplexity | Checks the npath complexity against a specified limit (default = 200). |
| NPathComplexity | Checks the npath complexity against a specified limit (default = 200). |
| NeedBraces | Checks for braces around code blocks. |
| NeedBraces | Checks for braces around code blocks. |
| NestedIfDepth | Restricts nested if-else blocks to a specified depth (default = 1). |
| NestedIfDepth | Restricts nested if-else blocks to a specified depth (default = 1). |
| NestedTryDepth | Restricts nested try-catch-finally blocks to a specified depth (default = 1). |
| NestedTryDepth | Restricts nested try-catch-finally blocks to a specified depth (default = 1). |
| NewlineAtEndOfFile | Checks that there is a newline at the end of each file. |
| 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. |
| NoClone | Checks that the clone method is not overridden from the Object class. |
| NoFinalizer | Checks that no method having zero parameters is defined using the name finalize. |
| NoFinalizer | Checks that no method having zero parameters is defined using the name finalize. |
| NoWhitespaceAfter | Checks that there is no whitespace after a token. |
| NoWhitespaceAfter | Checks that there is no whitespace after a token. |
| NoWhitespaceBefore | Checks that there is no whitespace before a token. |
| NoWhitespaceBefore | Checks that there is no whitespace before a token. |
| OperatorWrap | Checks line wrapping for operators. |
| OperatorWrap | Checks line wrapping for operators. |
| PackageDeclaration | Ensures there is a package declaration. |
| PackageDeclaration | Ensures there is a package declaration. |
| PackageName | Checks that package names conform to a format specified by the format property. |
| PackageName | Checks that package names conform to a format specified by the format property. |
| ParameterAssignment | Disallow assignment of parameters. |
| ParameterAssignment | Disallow assignment of parameters. |
| ParameterName | Checks that parameter names conform to a format specified by the format property. |
| ParameterName | Checks that parameter names conform to a format specified by the format property. |
| ParameterNumber | Checks the number of parameters that a method or constructor has. |
| 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. |
| 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. |
| RedundantImport | Checks for imports that are redundant. |
| RedundantModifier | Checks for redundant modifiers in interface and annotation definitions. |
| RedundantModifier | Checks for redundant modifiers in interface and annotation definitions. |
| RedundantThrows | Checks for redundant exceptions declared in throws clause such as duplicates, unchecked exceptions or subclasses of another declared exception. |
| RedundantThrows | Checks for redundant exceptions declared in throws clause such as duplicates, unchecked exceptions or subclasses of another declared exception. |
| Regexp | A check that makes sure that a specified pattern exists (or not) in the file. |
| 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 |
| RegexpHeader | Checks the header of the source against a header file that contains a |
| RequireThis | Checks that code doesn't rely on the "this" default. |
| RequireThis | Checks that code doesn't rely on the "this" default. |
| RequiredRegexp | A check that makes sure that a specified pattern exists in the code. |
| RequiredRegexp | A check that makes sure that a specified pattern exists in the code. |
| ReturnCount | Restricts return statements to a specified count (default = 2). |
| ReturnCount | Restricts return statements to a specified count (default = 2). |
| RightCurly | Checks the placement of right curly braces. |
| RightCurly | Checks the placement of right curly braces. |
| SimplifyBooleanExpression | Checks for overly complicated boolean expressions. |
| SimplifyBooleanExpression | Checks for overly complicated boolean expressions. |
| SimplifyBooleanReturn | Checks for overly complicated boolean return statements. |
| SimplifyBooleanReturn | Checks for overly complicated boolean return statements. |
| StaticVariableName | Checks that static, non-final variable names conform to a format specified by the format property. |
| StaticVariableName | Checks that static, non-final variable names conform to a format specified by the format property. |
| StrictDuplicateCode | Performs a line-by-line comparison of all code lines and reports duplicate code if a sequence of lines differs only in indentation. |
| StrictDuplicateCode | Performs a line-by-line comparison of all code lines and reports duplicate code if a sequence of lines differs only in indentation. |
| StringLiteralEquality |
Checks that string literals are not used with
== or !=.
|
| StringLiteralEquality |
Checks that string literals are not used with
== or !=.
|
| SuperClone | Checks that an overriding clone() method invokes super.clone(). |
| SuperClone | Checks that an overriding clone() method invokes super.clone(). |
| SuperFinalize | Checks that an overriding finalize() method invokes super.finalize(). |
| SuperFinalize | Checks that an overriding finalize() method invokes super.finalize(). |
| TabCharacter | Reports tab characters ('\t') in the source code. |
| TabCharacter | Reports tab characters ('\t') in the source code. |
| ThrowsCount | Restricts throws statements to a specified count (default = 1). |
| ThrowsCount | Restricts throws statements to a specified count (default = 1). |
| TodoComment | A check for TODO comments. |
| TodoComment | A check for TODO comments. |
| TrailingComment | The check to ensure that requires that comments be the only thing on a line. |
| 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. |
| Translation | The TranslationCheck class helps to ensure the correct translation of code by checking property files for consistency regarding their keys. |
| TypeName | Checks that type names conform to a format specified by the format property. |
| TypeName | Checks that type names conform to a format specified by the format property. |
| TypecastParenPad | Checks the padding of parentheses for typecasts. |
| TypecastParenPad | Checks the padding of parentheses for typecasts. |
| UncommentedMain | Detects uncommented main methods. |
| UncommentedMain | Detects uncommented main methods. |
| UnnecessaryParentheses | Checks if unnecessary parentheses are used in a statement or expression. |
| UnnecessaryParentheses | Checks if unnecessary parentheses are used in a statement or expression. |
| UnusedImports | Checks for unused import statements. |
| UnusedImports | Checks for unused import statements. |
| UpperEll | Checks that long constants are defined with an upper ell. |
| UpperEll | Checks that long constants are defined with an upper ell. |
| VisibilityModifier | Checks visibility of class members. |
| 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. |
| 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. |
| WhitespaceAround | Checks that a token is surrounded by whitespace. |
| WriteTag | Outputs a JavaDoc tag as information. |
| WriteTag | Outputs a JavaDoc tag as information. |