Package com.puppycrawl.tools.checkstyle.checks.coding
Contains the Coding checks that are
bundled with the main distribution.
-
Class Summary Class Description AbstractIllegalCheck Deprecated. Checkstyle will not support abstract checks anymore.AbstractIllegalMethodCheck Deprecated. Checkstyle will not support abstract checks anymore.AbstractNestedDepthCheck Deprecated. Checkstyle will not support abstract checks anymore.AbstractSuperCheck Abstract class for checking that an overriding method with no parameters invokes the super method.AbstractSuperCheck.MethodNode Stack node for a method definition and a record of whether the method has a call to the super method.ArrayTrailingCommaCheck Checks if array initialization contains optional trailing comma.AvoidInlineConditionalsCheck Detects inline conditionals.CovariantEqualsCheck Checks that if a class defines a covariant method equals, then it defines method equals(java.lang.Object).DeclarationOrderCheck Checks that the parts of a class or interface declaration appear in the order suggested by the Code Conventions for the Java Programming Language.DeclarationOrderCheck.ScopeState Private class to encapsulate the state.DefaultComesLastCheck Check that thedefault
is after all thecase
s in aswitch
statement.EmptyStatementCheck Detects empty statements (standalone ';').EqualsAvoidNullCheck Checks that any combination of String literals is on the left side of an equals() comparison.EqualsAvoidNullCheck.FieldFrame Holds the names of fields of a type.EqualsHashCodeCheck Checks that classes that either overrideequals()
orhashCode()
also overrides the other.ExplicitInitializationCheck Checks if any class or object member explicitly initialized to default for its type value (null
for object references, zero for numeric types andchar
andfalse
forboolean
.FallThroughCheck Checks for fall through in switch statements Finds locations where a case contains Java code - but lacks a break, return, throw or continue statement.FinalLocalVariableCheck Ensures that local variables that never get their values changed, must be declared final.FinalLocalVariableCheck.FinalVariableCandidate Represents information about final local variable candidate.FinalLocalVariableCheck.ScopeData Holder for the scope data.HiddenFieldCheck Checks that a local variable or a parameter does not shadow a field that is defined in the same class.HiddenFieldCheck.FieldFrame Holds the names of static and instance fields of a type.IllegalCatchCheck Catching java.lang.Exception, java.lang.Error or java.lang.RuntimeException is almost never acceptable.IllegalInstantiationCheck Checks for illegal instantiations where a factory method is preferred.IllegalThrowsCheck Throwing java.lang.Error or java.lang.RuntimeException is almost never acceptable.IllegalTokenCheck Checks for illegal tokens.IllegalTokenTextCheck Checks for illegal token text.IllegalTypeCheck Checks that particular class are never used as types in variable declarations, return values or parameters.InnerAssignmentCheck Checks for assignments in subexpressions, such as inString s = Integer.toString(i = 2);
.MagicNumberCheck Checks that there are no "magic numbers" where a magic number is a numeric literal that is not defined as a constant.MissingCtorCheck Checks that classes (except abstract one) define a ctor and don't rely on the default one.MissingSwitchDefaultCheck Checks that switch statement has "default" clause.ModifiedControlVariableCheck Check for ensuring that for loop control variables are not modified inside the for block.MultipleStringLiteralsCheck Checks for multiple occurrences of the same string literal within a single file.MultipleStringLiteralsCheck.StringInfo This class contains information about where a string was found.MultipleVariableDeclarationsCheck Checks that each variable declaration is in its own statement and on its own line.NestedForDepthCheck Check the number of nestedfor
-statements.NestedIfDepthCheck Restricts nested if-else blocks to a specified depth (default = 1).NestedTryDepthCheck Restricts nested try-catch-finally blocks to a specified depth (default = 1).NoCloneCheck Checks that the clone method is not overridden from the Object class.NoFinalizerCheck Checks that no method having zero parameters is defined using the name finalize.OneStatementPerLineCheck Restricts the number of statements per line to one.OverloadMethodsDeclarationOrderCheck Checks that overload methods are grouped together.PackageDeclarationCheck Ensures there is a package declaration.ParameterAssignmentCheck Disallow assignment of parameters.RequireThisCheck Checks that code doesn't rely on the "this" default.RequireThisCheck.AbstractFrame A declaration frame.RequireThisCheck.AnonymousClassFrame An anonymous class frame; holds instance variable names.RequireThisCheck.BlockFrame A frame initiated on entering a statement list; holds local variable names.RequireThisCheck.ClassFrame A frame initiated at class, enum or interface definition; holds instance variable names.RequireThisCheck.ConstructorFrame A frame initiated at constructor definition.RequireThisCheck.MethodFrame A frame initiated at method definition; holds a method definition token.ReturnCountCheck Restricts the number of return statements in methods, constructors and lambda expressions (2 by default).SimplifyBooleanExpressionCheck Checks for overly complicated boolean expressions.SimplifyBooleanReturnCheck Checks for overly complicated boolean return statements.StringLiteralEqualityCheck Checks that string literals are not used with==
or!=
.SuperCloneCheck Checks that an overriding clone() method invokes super.clone().SuperFinalizeCheck Checks that an overriding finalize() method invokes super.finalize().UnnecessaryParenthesesCheck Checks if unnecessary parentheses are used in a statement or expression.VariableDeclarationUsageDistanceCheck Checks the distance between declaration of variable and its first usage. -
Enum Summary Enum Description RequireThisCheck.FrameType An AbstractFrame type.