PMD规则之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.

翻译   变量命名约定:变量命名规则-根据你的喜好调整。当前规则检查final类型变量应该全部大写而且非final变量应该不包含下划线。

·  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'.

翻译   抽象类命名:抽象类应该命名为‘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.

翻译   令人疑惑的hashCode方法名:方法名和返回值类似于hashCode(),将令人误解为你试图覆盖hashCode()方法。

·  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.

翻译   令人疑惑的常量字段名:一个字段的名称全部用大些字符表示是SunJAVA命名规则,表示这个是常量。然而,字段不是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.

翻译   令人迷惑的equals方法名:方法名和参数近似于equals(Object),可能让人迷惑为你想覆盖equals(Object)方法

·  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.

翻译   令人迷惑的变量名:检测到非字段类型以m_开头,这通常表示这是一个字段所以这种做法让人迷惑。

·  BooleanGetMethodName: Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()'.

翻译   返回布尔类型的方法命名:发现返回布尔类型的方法被命名为’getX()’,而惯例是命名为‘isX()’的形式。

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值