1 | BigDecimalInstantiation | Checks for calls to the BigDecimal constructors that take a double parameter, which may result in an unexpected BigDecimal value. |
2 | BooleanInstantiation | Use Boolean.valueOf() for variable values or Boolean.TRUE and Boolean.FALSE for constant values instead of calling the Boolean() constructor directly or calling Boolean.valueOf(true) or Boolean.valueOf(false). |
3 | CatchError | Catching Error is dangerous; it can catch exceptions such as ThreadDeath and OutOfMemoryError. |
4 | CatchException | Catching Exception is often too broad or general. It should usually be restricted to framework or infrastructure code, rather than application code. |
5 | CatchNullPointerException | Catching NullPointerException is never appropriate. It should be avoided in the first place with proper null checking, and it can mask underlying errors. |
6 | CatchRuntimeException | Catching RuntimeException is often too broad or general. It should usually be restricted to framework or infrastructure code, rather than application code. |
7 | CatchThrowable | Catching Throwable is dangerous; it can catch exceptions such as ThreadDeath and OutOfMemoryError. |
8 | CloneableWithoutClone | A class that implements java.lang.Cloneable should define a clone() method. |
9 | ConstantIfExpression | Checks for if statements with a constant value for the if expression, such as true, false, null, or a literal constant value. |
10 | ConstantTernaryExpression | Checks for ternary expressions with a constant value for the boolean expression, such as true, false, null, or a literal constant value. |
11 | DuplicateImport | Duplicate import statements are unnecessary. |
12 | EmptyCatchBlock | In most cases, exceptions should not be caught and ignored (swallowed). |
13 | EmptyElseBlock | Empty else blocks are confusing and serve no purpose. |
14 | EmptyFinallyBlock | Empty finally blocks are confusing and serve no purpose. |
15 | EmptyForStatement | Empty for statements are confusing and serve no purpose. |
16 | EmptyIfStatement | Empty if statements are confusing and serve no purpose. |
17 | EmptySwitchStatement | Empty switch statements are confusing and serve no purpose. |
18 | EmptySynchronizedStatement | Empty synchronized statements are confusing and serve no purpose. |
19 | EmptyTryBlock | Empty try blocks are confusing and serve no purpose. |
20 | EmptyWhileStatement | Empty while statements are confusing and serve no purpose. |
21 | EqualsAndHashCode | If either the boolean equals(Object) or the int hashCode() methods are overridden within a class, then both must be overridden. |
22 | GrailsPublicControllerMethod | Checks for public methods on Grails controller classes. Static methods are ignored. |
23 | GrailsServletContextReference | Checks for references to the servletContext object from within Grails controller and taglib classes. |
24 | GrailsStatelessService | Checks for fields on Grails service classes. Grails service classes are singletons, by default, and so they should be reentrant and typically stateless. The ignoreFieldNames property specifies one or more field names that should be ignored. The ignoreFieldTypes property specifies one or more field type names that should be ignored. Both can optionally contain wildcard characters ('*' or '?'). |
25 | ImportFromSamePackage | An import of a class that is within the same package is unnecessary. |
26 | ReturnFromFinallyBlock | Returning from a finally block is confusing and can hide the original exception. |
27 | StringInstantiation | Use a String literal (e.g., "...") instead of calling the corresponding String constructor (new String("..")) directly. |
28 | ThrowError | Checks for throwing an instance of java.lang.Error. |
29 | ThrowException | Checks for throwing an instance of java.lang.Exception. |
30 | ThrowExceptionFromFinallyBlock | Throwing an exception from a finally block is confusing and can hide the original exception. |
31 | ThrowNullPointerException | Checks for throwing an instance of java.lang.NullPointerException. |
32 | ThrowRuntimeException | Checks for throwing an instance of java.lang.RuntimeException. |
33 | ThrowThrowable | Checks for throwing an instance of java.lang.Throwable. |
34 | UnnecessaryBooleanExpression | Checks for unnecessary boolean expressions, including ANDing (&&) or ORing (||) with true, false, null, or a Map/List/String/Number literal. Also checks for negation (!) of true, false, null, or a Map/List/String/Number literal. |
35 | UnnecessaryGroovyImport | A Groovy file does not need to include an import for classes from java.lang, java.util, java.io, java.net, groovy.lang and groovy.util, as well as the classes java.math.BigDecimal and java.math.BigInteger. |
36 | UnnecessaryIfStatement | Checks for if statements where the if and else blocks are merely returning true and false constants. These cases can be replaced by a simple return statement. |
37 | UnnecessaryTernaryExpression | 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. Also checks for ternary expressions where both expressions are the same constant or variable. |
38 | UnusedArray | Checks for array allocations that are not assigned or used, unless it is the last statement within a block. |
39 | UnusedImport | Imports for a class that is never referenced within the source file is unnecessary. |
40 | UnusedObject | Checks for object allocations that are not assigned or used, unless it is the last statement within a block |
41 | UnusedPrivateField | Checks for private fields that are not referenced within the same class. |
42 | UnusedPrivateMethod | Checks for private methods that are not referenced within the same class. |
43 | UnusedVariable | Checks for variables that are never referenced. |