Available Checks

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.

  Ensures that the names of abstract classes conforming to some regular expression.
  Ensures that the names of abstract classes conforming to some regular expression.
  Abstract class for checking interface requirements.
  Checks for long anonymous inner classes.
  Checks for long anonymous inner classes.
  Checks if array initialization contains optional trailing comma.
  Checks if array initialization contains optional trailing comma.
  Checks the style of array type definitions.
  Checks the style of array type definitions.
  Detects inline conditionals.
  Detects inline conditionals.
  Finds nested blocks.
  Finds nested blocks.
  Check that finds import statements that use the * notation.
  Check that finds import statements that use the * notation.
  Restricts nested boolean operators (&&, || and ^) to a specified depth (default = 3).
  Restricts nested boolean operators (&&, || and ^) to a specified depth (default = 3).
  This metric measures the number of instantiations of other classes within the given class.
  This metric measures the number of instantiations of other classes within the given class.
  The number of other classes a given class relies on.
  The number of other classes a given class relies on.
  Checks that constant names conform to a format specified by the format property.
  Checks that constant names conform to a format specified by the format property.
  Checks that if a class defines a covariant method equals, then it defines method equals(java.lang.Object).
  Checks that if a class defines a covariant method equals, then it defines method equals(java.lang.Object).
  Checks cyclomatic complexity against a specified limit.
  Checks cyclomatic complexity against a specified limit.
  Checks that the parts of a class or interface declaration appear in the order suggested by the Code Conventions for the Java Programming Language.
  Checks that the parts of a class or interface declaration appear in the order suggested by the Code Conventions for the Java Programming Language.
  Check that the default is after all the cases in a switch statement.
  Check that the default is after all the cases in a switch statement.
  Checks for restricted tokens beneath other tokens.
  Checks for restricted tokens beneath other tokens.
  Checks that classes are designed for inheritance.
  Checks that classes are designed for inheritance.
  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.
  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.
  Checks for empty blocks.
  Checks for empty blocks.
  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.
  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.
  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.
  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.
  Detects empty statements (standalone ';').
  Detects empty statements (standalone ';').
  Checks that an EntityBean implementation satisfies EntityBean requirements.
  Checks that an EntityBean implementation satisfies EntityBean requirements.
  Checks that classes that override equals() also override hashCode().
  Checks that classes that override equals() also override hashCode().
  Restricts the number of executable statements to a specified limit (default = 30).
  Restricts the number of executable statements to a specified limit (default = 30).
  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.
  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.
  Checks for fall through in switch statements Finds locations where a case contains Java code - but lacks a break, return, throw or continue statement.
  Checks for fall through in switch statements Finds locations where a case contains Java code - but lacks a break, return, throw or continue statement.
  Checks for long source files.
  Checks for long source files.
  Checks that class which has only private ctors is declared as final.
  Checks that class which has only private ctors is declared as final.
  Ensures that local variables that never get their values changed, must be declared final.
  Ensures that local variables that never get their values changed, must be declared final.
  Check that method/constructor/catch/foreach parameters are final.
  Check that method/constructor/catch/foreach parameters are final.
  Checks that all static fields are declared final.
  Checks that all static fields are declared final.
  A generic check for code problems, the user can search for any pattern.
  A generic check for code problems, the user can search for any pattern.
  Checks the header of the source against a fixed header file.
  Checks the header of the source against a fixed header file.
  Checks that a local variable or a parameter does not shadow a field that is defined in the same class.
  Checks that a local variable or a parameter does not shadow a field that is defined in the same class.
  Make sure that utility classes (classes that contain only static methods) do not have a public constructor.
  Make sure that utility classes (classes that contain only static methods) do not have a public constructor.
  Catching java.lang.Exception, java.lang.Error or java.lang.RuntimeException is almost never acceptable.
  Catching java.lang.Exception, java.lang.Error or java.lang.RuntimeException is almost never acceptable.
  Checks for imports from a set of illegal packages.
  Checks for imports from a set of illegal packages.
  Checks for illegal instantiations where a factory method is preferred.
  Checks for illegal instantiations where a factory method is preferred.
  Throwing java.lang.Error or java.lang.RuntimeException is almost never acceptable.
  Throwing java.lang.Error or java.lang.RuntimeException is almost never acceptable.
  Checks for illegal tokens.
  Checks for illegal tokens.
  Checks for illegal token text.
  Checks for illegal token text.
  Checks that particular class are never used as types in variable declarations, return values or parameters.
  Checks that particular class are never used as types in variable declarations, return values or parameters.
  Check that controls what packages can be imported in each package.
  Check that controls what packages can be imported in each package.
  Class to check the ordering/grouping of imports.
  Class to check the ordering/grouping of imports.
  Checks correct indentation of Java Code.
  Checks correct indentation of Java Code.
  Checks for assignments in subexpressions, such as in String s = Integer.toString(i = 2);.
  Checks for assignments in subexpressions, such as in String s = Integer.toString(i = 2);.
  Implements Bloch, Effective Java, Item 17 - Use Interfaces only to define types.
  Implements Bloch, Effective Java, Item 17 - Use Interfaces only to define types.
  Ensures that the setUp(), tearDown()methods are named correctly, have no arguments, return void and are either public or protected.
  Ensures that the setUp(), tearDown()methods are named correctly, have no arguments, return void and are either public or protected.
  This check calculates the Non Commenting Source Statements (NCSS) metric for java source files and methods.
  This check calculates the Non Commenting Source Statements (NCSS) metric for java source files and methods.
  Checks the Javadoc of a method or constructor.
  Checks the Javadoc of a method or constructor.
  Custom Checkstyle Check to validate Javadoc.
  Custom Checkstyle Check to validate Javadoc.
  Checks the Javadoc of a type.
  Checks the Javadoc of a type.
  Checks that a variable has Javadoc comment.
  Checks that a variable has Javadoc comment.
  Checks the placement of left curly braces on types, methods and other blocks:
  Checks the placement of left curly braces on types, methods and other blocks:
  Checks for long lines.
  Checks for long lines.
  Checks that local final variable names conform to a format specified by the format property.
  Checks that local final variable names conform to a format specified by the format property.
  Checks the local home interface requirements:
  • every method must not throw the java.rmi.RemoteException
Reference: Enterprise JavaBeansTM Specification,Version 2.0, section 9.6.2.
  Checks the local home interface requirements:
  • every method must not throw the java.rmi.RemoteException
Reference: Enterprise JavaBeansTM Specification,Version 2.0, section 9.6.2.
  Checks the methods of a local interface.
  Checks the methods of a local interface.
  Checks that local, non-final variable names conform to a format specified by the format property.
  Checks that local, non-final variable names conform to a format specified by the format property.
  Checks for magic numbers.
  Checks for magic numbers.
  Checks that instance variable names conform to a format specified by the format property.
  Checks that instance variable names conform to a format specified by the format property.
  Checks that a MessageBean implementation satisfies MessageBean requirements.
  Checks that a MessageBean implementation satisfies MessageBean requirements.
  Checks for long methods.
  Checks for long methods.
  Checks that method names conform to a format specified by the format property.
  Checks that method names conform to a format specified by the format property.
  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.
  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.
  Checks that classes (except abstract one) define a ctor and don't rely on the default one.
  Checks that classes (except abstract one) define a ctor and don't rely on the default one.
  Checks that switch statement has "default" clause.
  Checks that switch statement has "default" clause.
  Check for ensuring that for loop control variables are not modified inside the for block.
  Check for ensuring that for loop control variables are not modified inside the for block.
  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.
  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.
  Checks for multiple occurrences of the same string literal within a single file.
  Checks for multiple occurrences of the same string literal within a single file.
  Checks that each variable declaration is in its own statement and on its own line.
  Checks that each variable declaration is in its own statement and on its own line.
  Ensures that exceptions (defined as any class name conforming to some regular expression) are immutable.
  Ensures that exceptions (defined as any class name conforming to some regular expression) are immutable.
  Checks the npath complexity against a specified limt (default = 200).
  Checks the npath complexity against a specified limt (default = 200).
  Checks for braces around code blocks.
  Checks for braces around code blocks.
  Restricts nested if-else blocks to a specified depth (default = 1).
  Restricts nested if-else blocks to a specified depth (default = 1).
  Restricts nested try-catch-finally blocks to a specified depth (default = 1).
  Restricts nested try-catch-finally blocks to a specified depth (default = 1).
  Checks that there is a newline at the end of each file.
  Checks that there is a newline at the end of each file.
  Checks that there is no whitespace after a token.
  Checks that there is no whitespace after a token.
  Checks that there is no whitespace before a token.
  Checks that there is no whitespace before a token.
  Checks line wrapping for operators.
  Checks line wrapping for operators.
  Ensures there is a package declaration.
  Ensures there is a package declaration.
  Checks that all packages have a package documentation.
  Checks that all packages have a package documentation.
  Checks that package names conform to a format specified by the format property.
  Checks that package names conform to a format specified by the format property.
  Disallow assignment of parameters.
  Disallow assignment of parameters.
  Checks that parameter names conform to a format specified by the format property.
  Checks that parameter names conform to a format specified by the format property.
  Checks the number of parameters that a method or constructor has.
  Checks the number of parameters that a method or constructor has.
  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.
  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.
  Checks for imports that are redundant.
  Checks for imports that are redundant.
  Checks for redundant modifiers in interface and annotation definitions.
  Checks for redundant modifiers in interface and annotation definitions.
  Checks for redundant exceptions declared in throws clause such as duplicates, unchecked exceptions or subclasses of another declared exception.
  Checks for redundant exceptions declared in throws clause such as duplicates, unchecked exceptions or subclasses of another declared exception.
  A check that makes sure that a specified pattern exists (or not) in the file.
  A check that makes sure that a specified pattern exists (or not) in the file.
  Checks the header of the source against a header file that contains a
  Checks the header of the source against a header file that contains a
  Checks the methods of a remote home interface.
  Checks the methods of a remote home interface.
  Checks the methods of a remote interface.
  Checks the methods of a remote interface.
  Checks that code doesn't rely on the "this" default.
  Checks that code doesn't rely on the "this" default.
  A check that makes sure that a specified pattern exists in the code.
  A check that makes sure that a specified pattern exists in the code.
  Restricts return statements to a specified count (default = 2).
  Restricts return statements to a specified count (default = 2).
  Checks the placement of right curly braces.
  Checks the placement of right curly braces.
  Checks that a SessionBean implementation satisfies SessionBean requirements.
  Checks that a SessionBean implementation satisfies SessionBean requirements.
  Checks for overly complicated boolean expressions.
  Checks for overly complicated boolean expressions.
  Checks for overly complicated boolean return statements.
  Checks for overly complicated boolean return statements.
  Checks that static, non-final variable names conform to a format specified by the format property.
  Checks that static, non-final variable names conform to a format specified by the format property.
  Performs a line-by-line comparison of all code lines and reports duplicate code if a sequence of lines differs only in indentation.
  Performs a line-by-line comparison of all code lines and reports duplicate code if a sequence of lines differs only in indentation.
  Checks that string literals are not used with == or !=.
  Checks that string literals are not used with == or !=.
  Checks that an overriding clone() method invokes super.clone().
  Checks that an overriding clone() method invokes super.clone().
  Checks that an overriding finalize() method invokes super.finalize().
  Checks that an overriding finalize() method invokes super.finalize().
  Reports tab characters ('\t') in the source code.
  Reports tab characters ('\t') in the source code.
  Checks that 'this' is not a parameter of any method calls or constructors for a bean.
  Checks that 'this' is not a parameter of any method calls or constructors for a bean.
  Checks that 'this' is not returned by a bean method.
  Checks that 'this' is not returned by a bean method.
  Restricts throws statements to a specified count (default = 1).
  Restricts throws statements to a specified count (default = 1).
  A check for TODO comments.
  A check for TODO comments.
  The check to ensure that requires that comments be the only thing on a line.
  The check to ensure that requires that comments be the only thing on a line.
  The TranslationCheck class helps to ensure the correct translation of code by checking property files for consistency regarding their keys.
  The TranslationCheck class helps to ensure the correct translation of code by checking property files for consistency regarding their keys.
  Checks that type names conform to a format specified by the format property.
  Checks that type names conform to a format specified by the format property.
  Checks the padding of parentheses for typecasts.
  Checks the padding of parentheses for typecasts.
  Detects uncommented main methods.
  Detects uncommented main methods.
  Checks if unnecessary parentheses are used in a statement or expression.
  Checks if unnecessary parentheses are used in a statement or expression.
  Checks for unused import statements.
  Checks for unused import statements.
  Checks that long constants are defined with an upper ell.
  Checks that long constants are defined with an upper ell.
  Checks visibility of class members.
  Checks visibility of class members.
  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.
  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.
  Checks that a token is surrounded by whitespace.
  Checks that a token is surrounded by whitespace.
Copyright © 2001-2005, Oliver Burn