Naming practices - provided by PMD
ShortVariable
Fields, local variables, or parameter names that are very short are not helpful to the reader.
LongVariable
Fields, formal arguments, or local variable names that are too long can make the code difficult to follow.
ShortMethodName
Method names that are very short are not helpful to the reader.
VariableNamingConventions
A variable naming conventions rule - customize this to your liking.
Currently, it checks for final variables that should be fully capitalized and non-final variables that should not include underscores.
MethodNamingConventions
Method names should always begin with a lower case character, and should not contain underscores.
ClassNamingConventions
Class names should always begin with an upper case character.
AbstractNaming
Abstract classes should be named 'AbstractXXX'.
AvoidDollarSigns
Avoid using dollar signs in variable/method/class/interface names.
MethodWithSameNameAsEnclosingClass
Non-constructor methods should not have the same name as the enclosing class.
SuspiciousHashcodeMethodName
The method name and return type are suspiciously close to hashCode(), which may denote an intention to override the hashCode() method.
SuspiciousConstantFieldName
Field names using all uppercase characters - Sun's Java naming conventions indicating constants - should be declared as final.
SuspiciousEqualsMethodName
The method name and parameter number are suspiciously close to equals(Object), which can denote anintention to override the equals(Object) method.
AvoidFieldNameMatchingTypeName
It is somewhat confusing to have a field name matching the declaring class name.
This probably means that type and/or field names should be chosen more carefully.
AvoidFieldNameMatchingMethodName
It can be confusing to have a field name with the same name as a method.
While this is permitted, having information (field) and actions (method) is not clear naming.
Developers versed in Smalltalk often prefer this approach as the methods denote accessor methods.
NoPackage
Detects when a class or interface does not have a package definition.
PackageCase
Detects when a package definition contains uppercase characters.
MisleadingVariableName
Detects when a non-field has a name starting with 'm_'. This usually denotes a field and could be confusing.
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.
ShortClassName
Classnames with fewer than five characters are not recommended.
GenericsNaming
Names for references to generic values should be limited to a single uppercase letter.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.