
rulesets.java.unusedcode.xml Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of walkmod-pmd-plugin Show documentation
Show all versions of walkmod-pmd-plugin Show documentation
Walkmod plugin to automatically fix the reported problems by PMD
<?xml version="1.0"?> <ruleset name="Unused Code" 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"> <description> The Unused Code ruleset contains rules that find unused or ineffective code. </description> <rule name="UnusedPrivateField" since="0.1" language="java" message="Avoid unused private fields such as ''{0}''." class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedPrivateFieldRule" externalInfoUrl="https://pmd.github.io/pmd-5.4.1/pmd-java/rules/java/unusedcode.html#UnusedPrivateField"> <description> Detects when a private field is declared and/or assigned a value, but not used. </description> <priority>3</priority> <example> <![CDATA[ public class Something { private static int FOO = 2; // Unused private int i = 5; // Unused private int j = 6; public int addOne() { return j++; } } ]]> </example> </rule> <rule name="UnusedLocalVariable" language="java" since="0.1" message="Avoid unused local variables such as ''{0}''." class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedLocalVariableRule" externalInfoUrl="https://pmd.github.io/pmd-5.4.1/pmd-java/rules/java/unusedcode.html#UnusedLocalVariable"> <description> Detects when a local variable is declared and/or assigned, but not used. </description> <priority>3</priority> <example> <![CDATA[ public class Foo { public void doSomething() { int i = 5; // Unused } } ]]> </example> </rule> <rule name="UnusedPrivateMethod" language="java" since="0.7" message="Avoid unused private methods such as ''{0}''." class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedPrivateMethodRule" externalInfoUrl="https://pmd.github.io/pmd-5.4.1/pmd-java/rules/java/unusedcode.html#UnusedPrivateMethod"> <description> Unused Private Method detects when a private method is declared but is unused. </description> <priority>3</priority> <example> <![CDATA[ public class Something { private void foo() {} // unused } ]]> </example> </rule> <rule name="UnusedFormalParameter" language="java" since="0.8" message="Avoid unused {0} parameters such as ''{1}''." class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedFormalParameterRule" externalInfoUrl="https://pmd.github.io/pmd-5.4.1/pmd-java/rules/java/unusedcode.html#UnusedFormalParameter"> <description> Avoid passing parameters to methods or constructors without actually referencing them in the method body. </description> <priority>3</priority> <example> <![CDATA[ public class Foo { private void bar(String howdy) { // howdy is not used } } ]]> </example> </rule> <rule name="UnusedModifier" language="java" since="1.02" message="Avoid modifiers which are implied by the context" class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedModifierRule" externalInfoUrl="https://pmd.github.io/pmd-5.4.1/pmd-java/rules/java/unusedcode.html#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> <priority>3</priority> <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> </rule> </ruleset>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy