All Downloads are FREE. Search and download functionalities are using the official Maven repository.

resources.report.rules.pmd.Naming_Rules.html Maven / Gradle / Ivy



Naming_Rules


Naming_Rules

ing_Rules">

Naming Rules

  • ShortVariable: Detects when a field, local, or parameter has a very short name.
  • LongVariable: Detects when a field, formal or local variable is declared with a long name.
  • ShortMethodName: Detects when very short method names are used.
  • 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 mean you are intending to override the hashCode() method.
  • SuspiciousConstantFieldName: A field name is all in uppercase characters, which in Sun's Java naming conventions indicate a constant. However, the field is not final.
  • SuspiciousEqualsMethodName: The method name and parameter number are suspiciously close to equals(Object), which may mean you are intending 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 could be more precise.
  • AvoidFieldNameMatchingMethodName: It is somewhat confusing to have a field name with the same name as a method. While this is totally legal, having information (field) and actions (method) is not clear naming.
  • NoPackage: Detects when a class or interface does not have a package definition.
  • PackageCase: Detects when a package definition contains upper case characters.
  • MisleadingVariableName: Detects when a non-field has a name starting with 'm_'. This usually indicates a field and thus is confusing.
  • BooleanGetMethodName: Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()'.




  • © 2015 - 2024 Weber Informatics LLC | Privacy Policy