<?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"
        class="net.sourceforge.pmd.rules.XPathRule">
    <description>
Detects when a field, local or parameter has a short name.
    </description>
      <properties>
          <property name="xpath">
              <value>
                  <![CDATA[
    //VariableDeclaratorId[string-length(@Image) < 3][not(ancestor::ForInit)]
                  ]]>
              </value>
          </property>
      </properties>
      <priority>3</priority>
    <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"
        class="net.sourceforge.pmd.rules.XPathRule">
    <description>
Detects when a field, formal or local variable is declared with a big name.
    </description>
      <priority>3</priority>
      <properties>
          <property name="xpath">
              <value>
                  <![CDATA[
    //VariableDeclaratorId[string-length(@Image) > 12]
                  ]]>
              </value>
          </property>
      </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"
        class="net.sourceforge.pmd.rules.XPathRule">
     <description>
Detects when very short method names are used.
     </description>
      <priority>3</priority>
      <properties>
          <property name="xpath">
              <value>
                  <![CDATA[
    //MethodDeclarator[string-length(@Image) < 3]
                  ]]>
              </value>
          </property>
      </properties>
     <example>
<![CDATA[
public class ShortMethod {
  public void a( int i ) { // Violation
  }
}
]]>
     </example>
  </rule>

</ruleset>



