Coding Checks
ArrayTrailingComma
Checks that array initialization contains a trailing comma.
AvoidDoubleBraceInitialization
Detects double brace initialization.
AvoidInlineConditionals
Detects inline conditionals.
AvoidNoArgumentSuperConstructorCall
Checks if call to superclass constructor without arguments is present.
ConstructorsDeclarationGrouping
Checks that all constructors are grouped together.
CovariantEquals
Checks that classes and records which define a covariant
equals()
method also override method equals(Object)
.
DeclarationOrder
Checks that the parts of a class, record, or interface declaration
appear in the order suggested by the Code Conventions for the Java Programming Language.
EmptyStatement
Detects empty statements (standalone
";"
semicolon).
EqualsAvoidNull
Checks that any combination of String literals
is on the left side of an equals() comparison.
EqualsHashCode
Checks that classes that either override
equals()
or hashCode()
also overrides the other.
ExplicitInitialization
Checks if any class or object member is 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.
FinalLocalVariable
Checks that local variables that never have their values changed are declared final.
HiddenField
Checks that a local variable or a parameter does not shadow
a field that is defined in the same class.
IllegalCatch
Checks that certain exception types do not appear in a catch statement.
IllegalInstantiation
Checks for illegal instantiations where a factory method is preferred.
IllegalThrows
Checks that specified types are not declared to be thrown.
IllegalToken
Checks for illegal tokens.
IllegalTokenText
Checks specified tokens text for matching an illegal pattern.
IllegalType
Checks that particular classes or interfaces are never used.
InnerAssignment
Checks for assignments in subexpressions, such as in
String s = Integer.toString(i = 2);
.
MagicNumber
Checks that there are no "magic numbers" where a magic number
is a numeric literal that is not defined as a constant.
MatchXpath
Evaluates Xpath query and report violation on all matching AST nodes.
MissingCtor
Checks that classes (except abstract ones) define a constructor
and don't rely on the default one.
MissingNullCaseInSwitch
Checks that a given switch statement or expression that use a reference type
in its selector expression has a
null
case label.
MissingSwitchDefault
Checks that switch statement has a
default
clause.
ModifiedControlVariable
Checks that for loop control variables are not modified inside the for block.
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.
NestedForDepth
Restricts nested
for
blocks to a specified depth.
NestedIfDepth
Restricts nested if-else blocks to a specified depth.
NestedTryDepth
Restricts nested try-catch-finally blocks to a specified depth.
NoArrayTrailingComma
Checks that array initialization do not contain a trailing comma.
NoClone
Checks that the clone method is not overridden from the
Object class.
NoEnumTrailingComma
Checks that enum definition does not contain a trailing comma.
NoFinalizer
Checks that there is no method
finalize
with zero parameters.
OneStatementPerLine
Checks that there is only one statement per line.
OverloadMethodsDeclarationOrder
Checks that overloaded methods are grouped together.
PackageDeclaration
Ensures that a class has a package declaration, and (optionally) whether
the package name matches the directory name for the source file.
ParameterAssignment
Disallows assignment of parameters.
RequireThis
Checks that references to instance variables and methods of the present
object are explicitly of the form "this.varName" or
"this.methodName(args)" and that those references don't
rely on the default behavior when "this." is absent.
ReturnCount
Restricts the number of return statements in methods, constructors
and lambda expressions.
SimplifyBooleanExpression
Checks for over-complicated boolean expressions.
SimplifyBooleanReturn
Checks for over-complicated boolean return or yield statements.
SuperClone
Checks that an overriding clone() method invokes super.clone().
SuperFinalize
Checks that an overriding finalize() method invokes super.finalize().
UnnecessaryParentheses
Checks if unnecessary parentheses are used in a statement or expression.
UnnecessarySemicolonAfterOuterTypeDeclaration
Checks if unnecessary semicolon is used after type declaration.
UnnecessarySemicolonAfterTypeMemberDeclaration
Checks if unnecessary semicolon is used after type member declaration.
UnnecessarySemicolonInEnumeration
Checks if unnecessary semicolon is in enum definitions.
UnnecessarySemicolonInTryWithResources
Checks if unnecessary semicolon is used in last resource declaration.
UnusedCatchParameterShouldBeUnnamed
Ensures that catch parameters that are not used are declared as an unnamed variable.
UnusedLambdaParameterShouldBeUnnamed
Ensures that lambda parameters that are not used are declared as an unnamed variable.
UnusedLocalVariable
Checks that a local variable is declared and/or assigned, but not used.
VariableDeclarationUsageDistance
Checks the distance between declaration of variable and its first usage.