Groovy Documentation

Package org.codenarc.rule.unnecessary

 

Class Summary
UnnecessaryBigDecimalInstantiationAstVisitor
UnnecessaryBigDecimalInstantiationRule It is unnecessary to instantiate BigDecimal objects.
UnnecessaryBigIntegerInstantiationAstVisitor
UnnecessaryBigIntegerInstantiationRule It is unnecessary to instantiate BigInteger objects.
UnnecessaryBooleanExpressionAstVisitor
UnnecessaryBooleanExpressionRule Rule that checks unnecessary boolean expressions, including ANDing (&&) or ORing (||) with true, false, null, or a Map/List/String/Number literal.
UnnecessaryBooleanInstantiationAstVisitor
UnnecessaryBooleanInstantiationRule Rule that checks for direct call to Boolean constructor - use Boolean.valueOf() instead.
UnnecessaryCallForLastElementAstVisitor
UnnecessaryCallForLastElementRule This rule checks for excessively verbose methods of accessing the last element of an array or list.
UnnecessaryCallToSubstringAstVisitor
UnnecessaryCallToSubstringRule Calling String.substring(0) always returns the original string.
UnnecessaryCatchBlockAstVisitor
UnnecessaryCatchBlockRule Violations are triggered when a catch block does nothing but throw the original exception.
UnnecessaryCollectCallAstVisitor
UnnecessaryCollectCallRule Some method calls to Object.collect(Closure) can be replaced with the spread operator.
UnnecessaryCollectionCallAstVisitor
UnnecessaryCollectionCallRule Useless call to collections.
UnnecessaryConstructorAstVisitor
UnnecessaryConstructorRule UnnecessaryConstructor
UnnecessaryDefInMethodDeclarationAstVisitor
UnnecessaryDefInMethodDeclarationRule If a method has a visibility modifier, then the def keyword is unneeded.
UnnecessaryDoubleInstantiationAstVisitor
UnnecessaryDoubleInstantiationRule It is unnecessary to instantiate Double objects.
UnnecessaryFloatInstantiationAstVisitor
UnnecessaryFloatInstantiationRule It is unnecessary to instantiate Float objects.
UnnecessaryGStringAstVisitor
UnnecessaryGStringRule String objects should be created with single quotes, and GString objects created with double quotes.
UnnecessaryGetterAstVisitor
UnnecessaryGetterRule Checks for explicit calls to getter/accessor methods which can, for the most part, be replaced by property access.
UnnecessaryIfStatementAstVisitor
UnnecessaryIfStatementRule Rule that checks for unnecessary if statements.
UnnecessaryInstantiationAstVisitor Base visitor for unnecessary constructor calls.
UnnecessaryInstantiationToGetClassAstVisitor
UnnecessaryInstantiationToGetClassRule Avoid instantiating an object just to call getClass() on it; use the .class public member instead.
UnnecessaryIntegerInstantiationAstVisitor
UnnecessaryIntegerInstantiationRule It is unnecessary to instantiate Integer objects.
UnnecessaryLongInstantiationAstVisitor
UnnecessaryLongInstantiationRule It is unnecessary to instantiate Long objects.
UnnecessaryModOneAstVisitor
UnnecessaryModOneRule Any expression mod 1 (exp % 1) is guaranteed to always return zero.
UnnecessaryNullCheckAstVisitor
UnnecessaryNullCheckBeforeInstanceOfAstVisitor
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.
UnnecessaryObjectReferencesAstVisitor
UnnecessaryObjectReferencesRule Violations are triggered when an excessive set of consecutive statements all reference the same variable.
UnnecessaryOverridingMethodAstVisitor
UnnecessaryOverridingMethodRule The overriding method merely calls the same method defined in a superclass.
UnnecessaryPublicModifierAstVisitor
UnnecessaryPublicModifierRule The 'public' modifier is not required on methods or classes.
UnnecessaryReturnKeywordAstVisitor
UnnecessaryReturnKeywordRule In Groovy, the return keyword is often optional.
UnnecessarySelfAssignmentAstVisitor
UnnecessarySelfAssignmentRule Method contains a pointless self-assignment to a variable or property.
UnnecessarySemicolonAstVisitor
UnnecessarySemicolonRule Semicolons as line terminators are not required in Groovy: remove them.
UnnecessaryStringInstantiationAstVisitor
UnnecessaryStringInstantiationRule Rule that checks for direct call to the String constructor that accepts a String literal.
UnnecessaryTernaryExpressionAstVisitor
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.
UnnecessaryTransientModifierAstVisitor
UnnecessaryTransientModifierRule The field is marked as transient, but the class isn't Serializable, so marking it as transient should have no effect.
VariableUsageFinder
 


Groovy Documentation