git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@113253 13f79535-47bb-0310-9956-ffa450edef68
86 lines
2.0 KiB
XML
86 lines
2.0 KiB
XML
<?xml version="1.0"?>
|
|
|
|
<ruleset name="Naming Rules">
|
|
<description>
|
|
The Naming Ruleset contains a collection of rules about names - too long, too short, and so forth.
|
|
</description>
|
|
|
|
|
|
<rule name="ShortVariable"
|
|
message="Avoid variables with short names such as ''{0}''"
|
|
class="net.sourceforge.pmd.rules.ShortVariableRule">
|
|
<description>
|
|
Detects when a field, local or parameter has a short name.
|
|
</description>
|
|
<properties>
|
|
<property name="minimumLength" value="3"/>
|
|
</properties>
|
|
<example>
|
|
<![CDATA[
|
|
public class Something {
|
|
private int q = 15; // VIOLATION - Field
|
|
|
|
public static void main( String as[] ) { // VIOLATION - Formal
|
|
int r = 20 + q; // VIOLATION - Local
|
|
|
|
for (int i = 0; i < 10; i++) { // Not a Violation (inside FOR)
|
|
r += q;
|
|
}
|
|
}
|
|
}
|
|
]]>
|
|
</example>
|
|
</rule>
|
|
|
|
<rule name="LongVariable"
|
|
message="Avoid excessively long variable names such as ''{0}''"
|
|
class="net.sourceforge.pmd.rules.LongVariableRule">
|
|
<description>
|
|
Detects when a field, formal or local variable is declared with a big name.
|
|
</description>
|
|
<properties>
|
|
<property name="minimumLength" value="12"/>
|
|
</properties>
|
|
<example>
|
|
<![CDATA[
|
|
public class Something {
|
|
int reallyLongIntName = -3; // VIOLATION - Field
|
|
|
|
public static void main( String argumentsList[] ) { // VIOLATION - Formal
|
|
int otherReallyLongName = -5; // VIOLATION - Local
|
|
|
|
for (int interestingIntIndex = 0; // VIOLATION - For
|
|
interestingIntIndex < 10;
|
|
interestingIntIndex ++ ) {
|
|
|
|
}
|
|
}
|
|
|
|
]]>
|
|
</example>
|
|
</rule>
|
|
|
|
<rule name="ShortMethodNameRule"
|
|
message="Avoid using short method names such as ''{0}''"
|
|
class="net.sourceforge.pmd.rules.ShortMethodNameRule">
|
|
<description>
|
|
Detects when very short method names are used.
|
|
</description>
|
|
<properties>
|
|
<property name="minimumLength" value="3"/>
|
|
</properties>
|
|
<example>
|
|
<![CDATA[
|
|
public class ShortMethod {
|
|
public void a( int i ) { // Violation
|
|
}
|
|
}
|
|
]]>
|
|
</example>
|
|
</rule>
|
|
|
|
</ruleset>
|
|
|
|
|
|
|