Rule Description KPI url
ExtendsObject No need to explicitly extend Object. Understandability
DontCallThreadRun Explicitly calling method will execute in the caller’s thread of control. Instead, call Thread.start() for the intended behavior. Understandability
CommentRequired Denotes whether comments are required (or unwanted) for specific language elements. Maintainability
CommentSize Determines whether the dimensions of non-header comments found are within the specified limits. Maintainability
CommentContent A rule for the politically correct… we don’t want to offend anyone. Understandability
DontImportSun Avoid importing anything from the ‘sun.*’ packages. These packages are not portable and are likely to change. Portability
UnnecessaryParentheses Sometimes expressions are wrapped in unnecessary parentheses, making them look like function calls. Understandability
DataflowAnomalyAnalysis The dataflow analysis tracks local definitions, undefinitions and references to variables on different paths on the data flow. From those informations there can be found various problems. (1.) UR – Anomaly: There is a reference to a variable that was not defined before. This is a bug and leads to an error. (2.) DU – Anomaly: A recently defined variable is undefined. These anomalies may appear in normal source text. (3.) DD – Anomaly: A recently defined variable is redefined. This is ominous but don’t have to be a bug. Maintainability
OneDeclarationPerLine Java allows the use of several variables declaration of the same type on one line. However, it can lead to quite messy code. This rule looks for several declarations on the same line. Understandability
AvoidPrefixingMethodParameters Prefixing parameters by ‘in’ or ‘out’ pollutes the name of the parameters and reduces code readability. To indicate whether or not a parameter will be modify in a method, its better to document method behavior with Javadoc. Understandability
ConfusingTernary Avoid negation within an “if” expression with an “else” clause. For example, rephrase: if (x != y) diff(); else same(); as: if (x == y) same(); else diff(); Most “if (x != y)” cases without an “else” are often return cases, so consistent use of this rule makes the code easier to read. Also, this resolves trivial ordering problems, such as “does the error case go first?” or “does the common case go first?”. Understandability
InstantiationToGetClass Avoid instantiating an object just to call getClass() on it; use the .class public member instead. Resource Utilization
UnnecessaryLocalBeforeReturn Avoid the creation of unnecessary local variables Understandability
UseVarargs Java 5 introduced the varargs parameter declaration for methods and constructors. This syntactic sugar provides flexibility for users of these methods and constructors, allowing them to avoid having to deal with the creation of an array. Understandability
DuplicateImports Duplicate or overlapping import statements should be avoided. Understandability
DontImportJavaLang Avoid importing anything from the package ‘java.lang’. These classes are automatically imported (JLS 7.5.3). Understandability
UnusedImports Avoid the use of unused import statements to prevent unwanted dependencies. Understandability
UnnecessaryFullyQualifiedName Import statements allow the use of non-fully qualified names. The use of a fully qualified name which is covered by an import statement is redundant. Consider using the non-fully qualified name. Understandability
MDBAndSessionBeanNamingConvention The EJB Specification states that any MessageDrivenBean or SessionBean should be suffixed by ‘Bean’. Understandability
RemoteSessionInterfaceNamingConvention A Remote Home interface type of a Session EJB should be suffixed by ‘Home’. Understandability
LocalInterfaceSessionNamingConvention The Local Interface of a Session EJB should be suffixed by ‘Local’. Understandability
LocalHomeNamingConvention The Local Home interface of a Session EJB should be suffixed by ‘LocalHome’. Understandability
RemoteInterfaceNamingConvention Remote Interface of a Session EJB should not have a suffix. Understandability
InvalidSlf4jMessageFormat Check for invalid message format in slf4j loggers. Analyzability
BooleanGetMethodName Methods that return boolean results should be named as predicate statements to denote this. I.e, ‘isReady()’, ‘hasValues()’, ‘canCommit()’, ‘willFail()’, etc. Avoid the use of the ‘get’ prefix for these methods. Understandability
ShortClassName Short Classnames with fewer than e.g. five characters are not recommended. Understandability
GenericsNaming Names for references to generic values should be limited to a single uppercase letter. Understandability
StringBufferInstantiationWithChar Individual character values provided as initialization arguments will be converted into integers. This can lead to internal buffer sizes that are larger than expected. Efficiency
UselessParentheses Useless parentheses should be removed. Understandability