<?xml version="1.0"?>

<ruleset name="Coupling Rules" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="../etc/ruleset_xml_schema.xml">
  <description>
    These are rules which find instances of high or inappropriate coupling between objects and packages.
  </description>

    <rule name="CouplingBetweenObjects"
        message="High amount of different objects as memebers donotes a high coupling"
        class="net.sourceforge.pmd.rules.CouplingBetweenObjects"
          externalInfoUrl="http://pmd.sourceforge.net/rules/coupling.html#CouplingBetweenObjects">
    <description>
Rule counts unique attributes, local variables and return types within an object. An amount
 higher than specified threshold can indicate a high degree of coupling.
    </description>
    <priority>3</priority>
    <properties>
      <property name="threshold" description="The unique type reporting threshold" value="20"/>
    </properties>
    <example>
<![CDATA[
import com.Blah;
import org.Bar;
import org.Bardo;
public class Foo {
 private Blah var1;
 private Bar var2;
 //followed by many imports of unique objects
 void ObjectC doWork() {
  Bardo var55;
  ObjectA var44;
  ObjectZ var93;
  return something;
 }
}
]]>
    </example>
  </rule>

  <rule name="ExcessiveImports"
     message="A high number of imports can indicate a high degree of coupling within an object."
     class="net.sourceforge.pmd.rules.ExcessiveImports"
          externalInfoUrl="http://pmd.sourceforge.net/rules/coupling.html#ExcessiveImports">
     <description>
A high number of imports can indicate a high degree of coupling within
an object. Rule counts the number of unique imports and reports a violation
if the count is above the user defined threshold.
  </description>
  <priority>3</priority>
  <properties>
      <property name="minimum" description="The import count reporting threshold" value="30"/>
  </properties>
  <example>
      <![CDATA[
import blah.blah.Baz;
import blah.blah.Bif;
// 18 others from the same package elided
public class Foo {
 public void doWork() {}
}
      ]]>
  </example>
   </rule>

    <rule name="LooseCoupling"
          message="Avoid using implementation types like ''{0}''; use the interface instead"
          class="net.sourceforge.pmd.rules.design.LooseCoupling"
          externalInfoUrl="http://pmd.sourceforge.net/rules/coupling.html#LooseCoupling">
      <description>
Avoid using implementation types (i.e., HashSet); use the interface (i.e, Set) instead
      </description>
        <priority>3</priority>
      <example>
<![CDATA[
import java.util.*;
public class Bar {
 // Use List instead
 private ArrayList list = new ArrayList();
 // Use Set instead
 public HashSet getFoo() {
  return new HashSet();
 }
}
  ]]>
      </example>
    </rule>

 </ruleset>


