Search code examples
javaeclipsepmd

PMD can't find rule UseSingleton


For some weird reason PMD is giving this error:

An internal error occurred during: "ReviewCode".
    Unable to find referenced rule UseSingleton; perhaps the rule name is mispelled?

this is how this rule is declared in my ruleset.xml:

   <rule ref="rulesets/java/design.xml/UseSingleton"/>

I'm using Eclipse Kepler with 4.0.6 PMD plugin version. What am I doing wrong?


Solution

  • See also the answer on the bug report #1339 and the changelog for 5.3.1:

    Language Java, ruleset design.xml: The rule “UseSingleton” has been renamed to “UseUtilityClass”. See also bugs #1059 and #1339.

    This is fixed with PMD 5.3.1 and later.

    For the time being, you'll need to manually fix the ruleset file and replace UseSingleton with UseUtilityClass. I'd suggest to shutdown eclipse, locate the ruleset.xml file in your workspace, change it, and start eclipse.