<commit_before><?xml version="1.0"?>

<ruleset name="Custom"
         xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">

    <rule ref="rulesets/java/basic.xml"/>
    <rule ref="rulesets/java/codesize.xml"/>

    <description>
        Rules which find instances of high or inappropriate coupling between objects and packages.
    </description>

    <rule name="CouplingBetweenObjects"
          since="1.04"
          message="High amount of different objects as members denotes a high coupling"
          class="net.sourceforge.pmd.lang.java.rule.coupling.CouplingBetweenObjectsRule"
          externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_coupling.html#couplingbetweenobjects">
        <description>
            This rule counts the number of unique attributes, local variables, and return types within an object.
            A number higher than the specified threshold can indicate a high degree of coupling.
        </description>
        <priority>3</priority>
        <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"-->
          <!--since="1.04"-->
          <!--message="A high number of imports can indicate a high degree of coupling within an object."-->
          <!--class="net.sourceforge.pmd.lang.java.rule.coupling.ExcessiveImportsRule"-->
          <!--externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_coupling.html#excessiveimports">-->
        <!--<description>-->
            <!--A high number of imports can indicate a high degree of coupling within an object. This rule-->
            <!--counts the number of unique imports and reports a violation if the count is above the-->
            <!--user-specified threshold.-->
        <!--</description>-->
        <!--<priority>3</priority>-->
        <!--<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"-->
          <!--since="0.7"-->
          <!--message="Avoid using implementation types like ''{0}''; use the interface instead"-->
          <!--class="net.sourceforge.pmd.lang.java.rule.coupling.LooseCouplingRule"-->
          <!--externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_coupling.html#loosecoupling">-->
        <!--<description>-->
            <!--The use of implementation types as object references limits your ability to use alternate-->
            <!--implementations in the future as requirements change. Whenever available, referencing objects-->
            <!--by their interface types provides much more flexibility.-->
        <!--</description>-->
        <!--<priority>3</priority>-->
        <!--<example>-->
            <!--<![CDATA[-->
<!--// sub-optimal approach-->
<!--private ArrayList<SomeType> list = new ArrayList<>();-->

<!--public HashSet<SomeType> getFoo() {-->
    <!--return new HashSet<SomeType>();-->
<!--}-->

<!--// preferred approach-->
<!--private List<SomeType> list = new ArrayList<>();-->

<!--public Set<SomeType> getFoo() {-->
    <!--return new HashSet<SomeType>();-->
<!--}-->
<!--]]>-->
        <!--</example>-->
    <!--</rule>-->

    <!--<rule name="LoosePackageCoupling"-->
          <!--since="5.0"-->
          <!--message="Use of ''{0}'' outside of package hierarchy ''{1}'' is not recommended; use recommended classes instead"-->
          <!--class="net.sourceforge.pmd.lang.java.rule.coupling.LoosePackageCouplingRule"-->
          <!--externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_coupling.html#loosepackagecoupling">-->
        <!--<properties>-->
            <!--<property name="packages">-->
                <!--<value>some.other.packagee</value>-->
            <!--</property>-->
        <!--</properties>-->
        <!--<description>-->
            <!--Avoid using classes from the configured package hierarchy outside of the package hierarchy,-->
            <!--except when using one of the configured allowed classes.-->
        <!--</description>-->
        <!--<priority>3</priority>-->
        <!--<example>-->
            <!--<![CDATA[-->
<!--package some.package;-->

<!--import some.other.package.subpackage.subsubpackage.DontUseThisClass;-->

<!--public class Bar {-->
    <!--DontUseThisClass boo = new DontUseThisClass();-->
<!--}-->
  <!--]]>-->
        <!--</example>-->
    <!--</rule>-->

    <!--<rule name="LawOfDemeter"-->
          <!--language="java"-->
          <!--since="5.0"-->
          <!--message="Potential violation of Law of Demeter"-->
          <!--class="net.sourceforge.pmd.lang.java.rule.coupling.LawOfDemeterRule"-->
          <!--externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_coupling.html#lawofdemeter">-->
        <!--<description>-->
            <!--The Law of Demeter is a simple rule, that says "only talk to friends". It helps to reduce coupling between classes-->
            <!--or objects.-->

            <!--See also the references:-->

            <!--*   <NAME>, <NAME>, and <NAME>. The Pragmatic Programmer. From Journeyman to Master. <NAME>, Amsterdam, October 1999.;-->
            <!--*   <NAME> and <NAME>. Assuring good style for object-oriented programs. Software, IEEE, 6(5):38–48, 1989.;-->
            <!--*   &lt;http://www.ccs.neu.edu/home/lieber/LoD.html>-->
            <!--*   &lt;http://en.wikipedia.org/wiki/Law_of_Demeter>-->
        <!--</description>-->
        <!--<priority>3</priority>-->
        <!--<example>-->
            <!--<![CDATA[-->
<!--public class Foo {-->
    <!--/**-->
     <!--* This example will result in two violations.-->
     <!--*/-->
    <!--public void example(Bar b) {-->
        <!--// this method call is ok, as b is a parameter of "example"-->
        <!--C c = b.getC();-->

        <!--// this method call is a violation, as we are using c, which we got from B.-->
        <!--// We should ask b directly instead, e.g. "b.doItOnC();"-->
        <!--c.doIt();-->

        <!--// this is also a violation, just expressed differently as a method chain without temporary variables.-->
        <!--b.getC().doIt();-->

        <!--// a constructor call, not a method call.-->
        <!--D d = new D();-->
        <!--// this method call is ok, because we have create the new instance of D locally.-->
        <!--d.doSomethingElse();-->
    <!--}-->
<!--}-->
<!--]]>-->
        <!--</example>-->
    <!--</rule>-->

</ruleset><commit_msg>Add all PMD checks back<commit_after><?xml version="1.0"?>

<ruleset name="Custom"
         xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">

    <rule ref="rulesets/java/basic.xml"/>
    <rule ref="rulesets/java/codesize.xml"/>

    <description>
        Rules which find instances of high or inappropriate coupling between objects and packages.
    </description>

    <rule name="CouplingBetweenObjects"
          since="1.04"
          message="High amount of different objects as members denotes a high coupling"
          class="net.sourceforge.pmd.lang.java.rule.coupling.CouplingBetweenObjectsRule"
          externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_coupling.html#couplingbetweenobjects">
        <description>
            This rule counts the number of unique attributes, local variables, and return types within an object.
            A number higher than the specified threshold can indicate a high degree of coupling.
        </description>
        <priority>3</priority>
        <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"
          since="1.04"
          message="A high number of imports can indicate a high degree of coupling within an object."
          class="net.sourceforge.pmd.lang.java.rule.coupling.ExcessiveImportsRule"
          externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_coupling.html#excessiveimports">
        <description>
            A high number of imports can indicate a high degree of coupling within an object. This rule
            counts the number of unique imports and reports a violation if the count is above the
            user-specified threshold.
        </description>
        <priority>3</priority>
        <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"
          since="0.7"
          message="Avoid using implementation types like ''{0}''; use the interface instead"
          class="net.sourceforge.pmd.lang.java.rule.coupling.LooseCouplingRule"
          externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_coupling.html#loosecoupling">
        <description>
            The use of implementation types as object references limits your ability to use alternate
            implementations in the future as requirements change. Whenever available, referencing objects
            by their interface types provides much more flexibility.
        </description>
        <priority>3</priority>
        <example>
            <![CDATA[
// sub-optimal approach
private ArrayList<SomeType> list = new ArrayList<>();

public HashSet<SomeType> getFoo() {
    return new HashSet<SomeType>();
}

// preferred approach
private List<SomeType> list = new ArrayList<>();

public Set<SomeType> getFoo() {
    return new HashSet<SomeType>();
}
]]>
        </example>
    </rule>

    <rule name="LoosePackageCoupling"
          since="5.0"
          message="Use of ''{0}'' outside of package hierarchy ''{1}'' is not recommended; use recommended classes instead"
          class="net.sourceforge.pmd.lang.java.rule.coupling.LoosePackageCouplingRule"
          externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_coupling.html#loosepackagecoupling">
        <properties>
            <property name="packages">
                <value>some.other.packagee</value>
            </property>
        </properties>
        <description>
            Avoid using classes from the configured package hierarchy outside of the package hierarchy,
            except when using one of the configured allowed classes.
        </description>
        <priority>3</priority>
        <example>
            <![CDATA[
package some.package;

import some.other.package.subpackage.subsubpackage.DontUseThisClass;

public class Bar {
    DontUseThisClass boo = new DontUseThisClass();
}
  ]]>
        </example>
    </rule>

    <rule name="LawOfDemeter"
          language="java"
          since="5.0"
          message="Potential violation of Law of Demeter"
          class="net.sourceforge.pmd.lang.java.rule.coupling.LawOfDemeterRule"
          externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_coupling.html#lawofdemeter">
        <description>
            The Law of Demeter is a simple rule, that says "only talk to friends". It helps to reduce coupling between classes
            or objects.

            See also the references:

            *   <NAME>, <NAME>, and <NAME>. The Pragmatic Programmer. From Journeyman to Master. <NAME>, Amsterdam, October 1999.;
            *   <NAME> and <NAME>. Assuring good style for object-oriented programs. Software, IEEE, 6(5):38–48, 1989.;
            *   &lt;http://www.ccs.neu.edu/home/lieber/LoD.html>
            *   &lt;http://en.wikipedia.org/wiki/Law_of_Demeter>
        </description>
        <priority>3</priority>
        <example>
            <![CDATA[
public class Foo {
    /**
     * This example will result in two violations.
     */
    public void example(Bar b) {
        // this method call is ok, as b is a parameter of "example"
        C c = b.getC();

        // this method call is a violation, as we are using c, which we got from B.
        // We should ask b directly instead, e.g. "b.doItOnC();"
        c.doIt();

        // this is also a violation, just expressed differently as a method chain without temporary variables.
        b.getC().doIt();

        // a constructor call, not a method call.
        D d = new D();
        // this method call is ok, because we have create the new instance of D locally.
        d.doSomethingElse();
    }
}
]]>
        </example>
    </rule>

</ruleset>
{'fraction_non_alphanumeric': 0.15855312735493596, 'fraction_numerical': 0.00904295403165034, 'mean_word_length': 2.2743646681470517, 'pattern_counts': {'":': 0, '<': 259, '<?xml version=': 2, '>': 263, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 10}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4758198', 'n_tokens_mistral': 3829, 'n_tokens_neox': 3636, 'n_words': 1029}