Class |
Description |
AddEmptyStringRule
|
Finds empty string literals which are being added. |
ConsecutiveLiteralAppendsRule
|
Violations occur when method calls to append(Object) are chained together with literals as parameters. |
ConsecutiveStringConcatenationRule
|
Catches concatenation of two string literals on the same line. |
UnnecessaryBigDecimalInstantiationRule
|
It is unnecessary to instantiate BigDecimal objects. |
UnnecessaryBigIntegerInstantiationRule
|
It is unnecessary to instantiate BigInteger objects. |
UnnecessaryBooleanExpressionRule
|
Rule that checks unnecessary boolean expressions, including ANDing (&&) or ORing (||) with
true , false , null , or a Map/List/String/Number literal. |
UnnecessaryBooleanInstantiationRule
|
Rule that checks for direct call to Boolean constructor - use Boolean.valueOf() instead.
|
UnnecessaryCallForLastElementRule
|
This rule checks for excessively verbose methods of accessing the last element of an array or list. |
UnnecessaryCallToSubstringRule
|
Calling String.substring(0) always returns the original string. |
UnnecessaryCastRule
|
Checks for unnecessary cast operations |
UnnecessaryCatchBlockRule
|
Violations are triggered when a catch block does nothing but throw the original exception. |
UnnecessaryCollectCallRule
|
Some method calls to Object.collect(Closure) can be replaced with the spread operator. |
UnnecessaryCollectionCallRule
|
Useless call to collections. |
UnnecessaryConstructorRule
|
UnnecessaryConstructor. |
UnnecessaryDefInFieldDeclarationRule
|
If a field has a visibility modifier or a type declaration, then the def keyword is unneeded. |
UnnecessaryDefInMethodDeclarationRule
|
If a method has a visibility modifier or a type declaration, then the def keyword is unneeded.
|
UnnecessaryDefInVariableDeclarationRule
|
If a variable has a visibility modifier or a type declaration, then the def keyword is unneeded.
|
UnnecessaryDotClassRule
|
To make a reference to a class, it is unnecessary to specify the '.class' identifier. |
UnnecessaryDoubleInstantiationRule
|
It is unnecessary to instantiate Double objects. |
UnnecessaryElseStatementRule
|
When an if statement block ends with a return statement the else is unnecessary |
UnnecessaryFinalOnPrivateMethodRule
|
A private method is marked final. |
UnnecessaryFloatInstantiationRule
|
It is unnecessary to instantiate Float objects. |
UnnecessaryGStringRule
|
String objects should be created with single quotes, and GString objects created with double quotes. |
UnnecessaryGetterRule
|
Checks for explicit calls to getter/accessor methods which can, for the most part, be replaced by property access.
|
UnnecessaryIfStatementRule
|
Rule that checks for unnecessary if statements. |
UnnecessaryInstanceOfCheckRule
|
This rule finds instanceof checks that cannot possibly evaluate to true. |
UnnecessaryInstantiationAstVisitor
|
Base visitor for unnecessary constructor calls. |
UnnecessaryInstantiationToGetClassRule
|
Avoid instantiating an object just to call getClass() on it; use the .class public member instead. |
UnnecessaryIntegerInstantiationRule
|
It is unnecessary to instantiate Integer objects. |
UnnecessaryLongInstantiationRule
|
It is unnecessary to instantiate Long objects. |
UnnecessaryModOneRule
|
Any expression mod 1 (exp % 1) is guaranteed to always return zero. |
UnnecessaryNullCheckBeforeInstanceOfRule
|
There is no need to check for null before an instanceof; the instanceof keyword returns false when given a null argument. |
UnnecessaryNullCheckRule
|
Groovy contains the safe dereference operator, which can be used in boolean conditional statements to safely
replace explicit "x == null" tests. |
UnnecessaryObjectReferencesRule
|
Violations are triggered when an excessive set of consecutive statements all reference the same variable. |
UnnecessaryOverridingMethodRule
|
The overriding method merely calls the same method defined in a superclass. |
UnnecessaryPackageReferenceRule
|
Checks for explicit package reference for classes that Groovy imports by default, such as java.lang.String,
java.util.Map and groovy.lang.Closure, as well as classes that were explicitly imported. |
UnnecessaryParenthesesForMethodCallWithClosureRule
|
If a method is called and the only parameter to that method is an inline closure then the brackets of the method call can be omitted. |
UnnecessaryPublicModifierRule
|
The 'public' modifier is not required on methods, constructors or classes. |
UnnecessaryReturnKeywordRule
|
In Groovy, the return keyword is often optional. |
UnnecessarySafeNavigationOperatorRule
|
Check for safe navigation operator (?.) |
UnnecessarySelfAssignmentRule
|
Method contains a pointless self-assignment to a variable or property. |
UnnecessarySemicolonRule
|
Semicolons as line terminators are not required in Groovy: remove them. |
UnnecessarySetterRule
|
Checks for explicit calls to setter methods which can, for the most part, be replaced by assignment to property.
|
UnnecessaryStringInstantiationRule
|
Rule that checks for direct call to the String constructor that accepts a String literal.
|
UnnecessaryTernaryExpressionRule
|
Rule that checks for ternary expressions where the conditional expression always evaluates to
a boolean and the true and false expressions are merely returning true and
false constants. |
UnnecessaryToStringRule
|
Checks for unnecessary calls to toString(). |
UnnecessaryTransientModifierRule
|
The field is marked as transient, but the class isn't Serializable, so marking it as transient should have no effect. |