<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="dede">
    <description>PMD Plugin preferences rule set</description>
    <rule class="net.sourceforge.pmd.rules.IdempotentOperations" message="Avoid idempotent operations (like assigning a variable to itself)" name="IdempotentOperations">
        <description>
      Avoid idempotent operations - they are silly.
      </description>
        <example><![CDATA[
      
    public class Foo {
     public void bar() {
      int x = 2;
      x = x;
     }
    }
      
      ]]></example>
        <priority>3</priority>
        <properties/>
    </rule>
    <rule class="net.sourceforge.pmd.rules.XPathRule" message="Avoid equality comparisons with Double.NaN" name="BadComparison">
        <description>
  Avoid equality comparisons with Double.NaN - these are
likely to be logic errors.
      </description>
        <example><![CDATA[
  
public class Bar {
int x = (y == Double.NaN);
}
  
      ]]></example>
        <priority>3</priority>
        <properties>
            <property name="xpath">
                <value><![CDATA[
                  
//EqualityExpression[@Image='==']
 /PrimaryExpression/PrimaryPrefix
 /Name[@Image='Double.NaN' or @Image='Float.NaN']
                  
              ]]></value>
            </property>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.design.SwitchDensityRule" message="A high ratio of statements to labels in a switch statement.  Consider refactoring." name="SwitchDensity">
        <description>
 A high ratio of statements to labels in a switch statement implies that the switch
 statement is doing too much work.  Consider moving the statements either into new
 methods, or creating subclasses based on the switch variable.
      </description>
        <example><![CDATA[
 
   public class Foo {
     private int x;
     public void bar() {
       switch (x) {
         case 1: {
           System.out.println("I am a fish.");
           System.out.println("I am a fish.");
           System.out.println("I am a fish.");
           System.out.println("I am a fish.");
           break;
         }

         case 2: {
           System.out.println("I am a cow.");
           System.out.println("I am a cow.");
           System.out.println("I am a cow.");
           System.out.println("I am a cow.");
           break;
         }
       }
     }
   }
 
      ]]></example>
        <priority>3</priority>
        <properties>
            <property name="minimum" value="10"/>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.UnusedModifier" message="Avoid modifiers which are implied by the context" name="UnusedModifier">
        <description>
     Fields in interfaces are automatically public static final, and
     methods are public abstract.
     Classes or interfaces nested in an interface are automatically public
     and static (all nested interfaces are automatically static).
     For historical reasons, modifiers which are implied by the context
     are accepted by the compiler, but are superfluous.
     </description>
        <example><![CDATA[
 
    public interface Foo {
     public abstract void bar(); // both abstract and public are ignored by the compiler
     public static final int X = 0; // public, static, and final all ignored
     public static class Bar {} // public, static ignored
     public static interface Baz {} // ditto
    }
    public class Bar {
     public static interface Baz {} // static ignored
    }
 
     ]]></example>
        <priority>3</priority>
        <properties/>
    </rule>
    <rule class="net.sourceforge.pmd.rules.XPathRule" message="clone() method should throw CloneNotSupportedException" name="CloneThrowsCloneNotSupportedException">
        <description>
        The method clone() should throw a CloneNotSupportedException
         </description>
        <example><![CDATA[
             
 public class MyClass implements Cloneable{
     public Object clone() // will cause an error {
          MyClass clone = (MyClass)super.clone();
          ...
          return clone;
     }
 }
    
         ]]></example>
        <priority>3</priority>
        <properties>
            <property name="xpath">
                <value><![CDATA[
                     
//ClassOrInterfaceDeclaration
[@Final = 'false']
[.//MethodDeclaration[
MethodDeclarator/@Image = 'clone'
and count(MethodDeclarator/FormalParameters/*) = 0
and count(NameList/Name[contains
(@Image,'CloneNotSupportedException')]) = 0]]
                     
                 ]]></value>
            </property>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.AvoidDeeplyNestedIfStmtsRule" message="Deeply nested if..then statements are hard to read" name="AvoidDeeplyNestedIfStmts">
        <description>
    Deeply nested if..then statements are hard to read.
    </description>
        <example><![CDATA[

public class Foo {
 public void bar() {
  int x=2;
  int y=3;
  int z=4;
  if (x>y) {
   if (y>z) {
    if (z==x) {
     // this is officially out of control now
    }
   }
  }
 }
}

    ]]></example>
        <priority>3</priority>
        <properties>
            <property name="problemDepth" value="3"/>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.design.TooManyFields" message="Too many fields" name="TooManyFields">
        <description>
       Classes that have too many fields could be redesigned to have less fields
       and some nested object grouping some of the information collected on the
       many fields.
      </description>
        <example><![CDATA[
   
   public Class Person {
       String street;
       int number;
       int floor;
       String postal;
       String street;
       long phone;
       String city;
       String state;
       String Country;
       // fields above should be in a class for Address or something similar
       // that information does not really belong to a person, but to a place
       // fields below are really from person
       String firstname;
       String lastname;
       Date born;
       Person father;
       Person mother;
   }
   
      ]]></example>
        <priority>3</priority>
        <properties>
            <property name="maximum" value="15"/>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.XPathRule" message="If you override finalize(), make it protected" name="FinalizeShouldBeProtected">
        <description>
      If you override finalize(), make it protected.  Otherwise, subclasses
          may not called your implementation of finalize.
      </description>
        <example><![CDATA[
  
public class Foo {
 public void finalize() {
  // do something
 }
}
  
      ]]></example>
        <priority>3</priority>
        <properties>
            <property name="xpath">
                <value><![CDATA[
                    
//MethodDeclaration[@Protected="false"]
  /MethodDeclarator[@Image="finalize"]
  [not(FormalParameters/*)]
                    
                ]]></value>
            </property>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.UnusedFormalParameterRule" message="Avoid unused formal parameters such as ''{0}''" name="UnusedFormalParameter">
        <description>
Avoid passing parameters to methods and then not using those parameters.
    </description>
        <example><![CDATA[

public class Foo {
 private void bar(String howdy) {
  // howdy is not used
 }

    ]]></example>
        <priority>3</priority>
        <properties/>
    </rule>
    <rule class="net.sourceforge.pmd.rules.XPathRule" message="Avoid excessively long variable names like {0}" name="LongVariable">
        <description>
Detects when a field, formal or local variable is declared with a long name.
    </description>
        <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>
        <priority>3</priority>
        <properties>
            <property name="xpath">
                <value><![CDATA[
                  
    //VariableDeclaratorId[string-length(@Image) > 17]
                  
              ]]></value>
            </property>
            <property name="pluginname" value="true"/>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.XPathRule" message="Avoid throwing raw exception types" name="AvoidThrowingRawExceptionTypes">
        <description>
Avoid throwing certain exception types.  Rather than throw a raw RuntimeException, Throwable,
 Exception, or Error, use a subclassed exception or error instead.
    </description>
        <example><![CDATA[
      
throw new Exception();

    ]]></example>
        <priority>1</priority>
        <properties>
            <property name="xpath">
                <value><![CDATA[
            
//AllocationExpression
 /ClassOrInterfaceType[
 @Image='Throwable' |
 @Image='Exception' |
 @Image='Error' |
 @Image='RuntimeException']
 
        ]]></value>
            </property>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.design.ConfusingTernary" message="Avoid if (x != y) ..; else ..;" name="ConfusingTernary">
        <description>
          In an "if" expression with an "else" clause, avoid negation in
          the test.  For example, rephrase:
            if (x != y) diff(); else same();
          as:
            if (x == y) same(); else diff();
          Most "if (x != y)" cases without an "else" are often return
          cases, so consistent use of this rule makes the code easier
          to read.  Also, this resolves trivial ordering problems, such
          as "does the error case go first?" or "does the common case
          go first?".
        </description>
        <example><![CDATA[
          
          return (x != y) ? diff : same;
          
        ]]></example>
        <priority>3</priority>
        <properties/>
    </rule>
    <rule class="net.sourceforge.pmd.rules.XPathRule" message="This abstract class does not have any abstract methods" name="AbstractClassWithoutAbstractMethod">
        <description>
      The abstract class does not contain any abstract methods. An abstract class suggests
      an incomplete implementation, which is to be completed by subclasses implementing the
      abstract methods. If the class is intended to be used as a base class only (not to be instantiated
      direcly) a protected constructor can be provided prevent direct instantiation.
      </description>
        <example><![CDATA[

public abstract class Foo {
	void int method1() { ... }
	void int method2() { ... }
	// consider using abstract methods or removing
	// the abstract modifier and adding protected constructors
}

      ]]></example>
        <priority>3</priority>
        <properties>
            <property name="xpath">
                <value><![CDATA[
//ClassOrInterfaceDeclaration
 [@Abstract='true'
  and count( .//MethodDeclaration[@Abstract='true'] )=0 ]
  [count(ImplementsList)=0]
              
              ]]></value>
            </property>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.XPathRule" message="This return statement may have some unnecessary parentheses" name="UnnecessaryParentheses">
        <description>
      Sometimes return statement expressions are wrapped in unnecessary parentheses,
 making them look like a function call.
      </description>
        <example><![CDATA[
  public class Foo {
      boolean bar() {
          return (true);
      }
  }
      ]]></example>
        <priority>3</priority>
        <properties>
            <property name="xpath">
                <value><![CDATA[
                
//ReturnStatement
          /Expression
           /PrimaryExpression
            /PrimaryPrefix
             /Expression[count(*)=1]
              /PrimaryExpression
              /PrimaryPrefix
            ]]></value>
            </property>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.XPathRule" message="No need to check for null before an instanceof" name="SimplifyConditional">
        <description>
      No need to check for null before an instanceof; the instanceof keyword returns false when given a null argument.
           </description>
        <example><![CDATA[
      
class Foo {
 void bar(Object x) {
  if (x != null && x instanceof Bar) {
   // just drop the "x != null" check
  }
 }
}      
           ]]></example>
        <priority>3</priority>
        <properties>
            <property name="xpath">
                <value><![CDATA[
                      
//Expression
 [ConditionalOrExpression
 [EqualityExpression[@Image='==']
  //NullLiteral
  and
  UnaryExpressionNotPlusMinus
   [@Image='!']//InstanceOfExpression[PrimaryExpression
     //Name/@Image = ancestor::ConditionalOrExpression/EqualityExpression
      //PrimaryPrefix/Name/@Image]]
or
ConditionalAndExpression
 [EqualityExpression[@Image='!=']//NullLiteral
 and
InstanceOfExpression
 [PrimaryExpression
  //Name/@Image = ancestor::ConditionalAndExpression
   /EqualityExpression//PrimaryPrefix/Name/@Image]]
 
                  ]]></value>
            </property>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.XPathRule" message="Explicit call of finalize method" name="ExplicitCallToFinalize">
        <description>
       An explicit call was made to a finalize method.  Finalize methods
       are meant to be executed at most once (by the garbage collector).
       Calling it explicitly could result in the method being executed
       twice for that object (once by you, once by the garbage collector).
       </description>
        <example><![CDATA[
   
public class Foo {
 public void close()  {
    finalize();       // this is bad
    foo.finalize();   // this is also bad
    this.finalize();  // this is bad but currently not flagged
    super.finalize(); // this is OK
    foo.finalize(3);  // this is arguably OK because the method is overloaded
 }
}
   
       ]]></example>
        <priority>3</priority>
        <properties>
            <property name="xpath">
                <value><![CDATA[

//PrimaryExpression[PrimarySuffix
 /Arguments[count(*) = 0]]
  /PrimaryPrefix
   /Name[@Image = 'finalize' or ends-with(@Image, '.finalize')]

                 ]]></value>
            </property>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.UnusedLocalVariableRule" message="Avoid unused local variables such as ''{0}''" name="UnusedLocalVariable">
        <description>
Detects when a local variable is declared and/or assigned, but not used.
    </description>
        <example><![CDATA[

public void doSomething() {
  int i = 5; // Unused
}

    ]]></example>
        <priority>3</priority>
        <properties/>
    </rule>
    <rule class="net.sourceforge.pmd.rules.optimization.LocalVariableCouldBeFinal" message="Local variable could be declared final" name="LocalVariableCouldBeFinal">
        <description>
      A local variable assigned only once can be declared final.
      </description>
        <example><![CDATA[
  
  public void foo () {
   String a = "a"; //if a will not be assigned again it is better to do this:
   final String b = "b";
   ...   
  }
  
      ]]></example>
        <priority>3</priority>
        <properties/>
    </rule>
    <rule class="net.sourceforge.pmd.rules.VariableNamingConventions" message="{0} variable {1} should begin with {2}" name="VariableNamingConventions">
        <description>
    A variable naming conventions rule - customize this to your liking
    Final variables should be all caps
    Non-final variables should not include underscores
        </description>
        <example><![CDATA[

public class Foo {
    public static final int MY_NUM = 0;
    public String myTest = "";
    DataModule dmTest = new DataModule();
}

        ]]></example>
        <priority>1</priority>
        <properties/>
    </rule>
    <rule class="net.sourceforge.pmd.rules.XPathRule" message="Avoid instantiating String objects; this is usually unnecessary." name="StringInstantiation">
        <description>
    Avoid instantiating String objects; this is usually unnecessary.
    </description>
        <example><![CDATA[

public class Foo {
 private String bar = new String("bar"); // just do a String bar = "bar";
}

    ]]></example>
        <priority>2</priority>
        <properties>
            <property name="xpath">
                <value><![CDATA[
                   
    //AllocationExpression[ClassOrInterfaceType/@Image='String'][count(.//Expression) < 2][not(ArrayDimsAndInits)]
                    
               ]]></value>
            </property>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.design.OnlyOneReturnRule" message="A method should have only one exit point, and that should be the last statement in the method" name="OnlyOneReturn">
        <description>
     A method should have only one exit point, and that should be the last statement in the method.
     </description>
        <example><![CDATA[
 
 public class OneReturnOnly1 {
  public void foo(int x) {
   if (x > 0) {
    return "hey";   // oops, multiple exit points!
   }
   return "hi";
  }
 }
 
     ]]></example>
        <priority>3</priority>
        <properties/>
    </rule>
    <rule class="net.sourceforge.pmd.rules.XPathRule" message="Avoid empty switch statements" name="EmptySwitchStatements">
        <description>
      Avoid empty switch statements.
      </description>
        <example><![CDATA[
  public class Foo {
   public void bar() {
    int x = 2;
    switch (x) {
     // once there was code here
     // but it's been commented out or something
    }
   }
  }
      ]]></example>
        <priority>3</priority>
        <properties>
            <property name="xpath">
                <value><![CDATA[
                  //SwitchStatement[count(*) = 1]
              ]]></value>
            </property>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.XPathRule" message="user assertSame(x, y) instead of assertTrue(x==y)" name="UseAssertSameInsteadOfAssertTrue">
        <description>
          This rule detects JUnit assertions in object references equality. These assertions
          should be made by more specific methods, like assertSame, assertNotSame.
      </description>
        <example><![CDATA[

public class FooTest extends TestCase {
    void testCode() {
        Object a, b;
        assertTrue(a==b); // bad usage
        assertSame(a, b);  // good usage
    }
}

      ]]></example>
        <priority>3</priority>
        <properties>
            <property name="xpath">
                <value><![CDATA[
                

//PrimaryExpression [
    PrimaryPrefix/Name[@Image = 'assertTrue' or @Image = 'assertFalse']
]
[PrimarySuffix/Arguments/ArgumentList/Expression/EqualityExpression[
        @Image = '==' or  @Image = '!='
    ]
]

 
            ]]></value>
            </property>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.XPathRule" message="Avoid unnecessary comparisons in boolean expressions" name="SimplifyBooleanExpressions">
        <description>
  Avoid unnecessary comparisons in boolean expressions - this makes simple code seem complicated.
      </description>
        <example><![CDATA[
  
public class Bar {
 // can be simplified to
 // bar = isFoo();
 private boolean bar = (isFoo() == true);

 public isFoo() { return false;}
}
  
      ]]></example>
        <priority>3</priority>
        <properties>
            <property name="xpath">
                <value><![CDATA[

//EqualityExpression/PrimaryExpression/PrimaryPrefix/Literal/BooleanLiteral

              ]]></value>
            </property>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.design.LongMethodRule" message="Avoid really long methods." name="ExcessiveMethodLength">
        <description>
Excessive Method Length usually means that the method is doing
too much.  There is usually quite a bit of Cut and Paste there
as well.  Try to reduce the method size by creating helper methods,
and r