PMDPlugin custom rules


I'm starting to use PMDPlugin for IntelliJ IDEA but I wanted to write my custom rules (basically remove some rules from the standard set). The problem is that I couldn't find anywhere where are the default ruleset paths for the plugin.

After trying some variations unsuccessfully, I checked the source code of the plugin and finally found out: paths follow the pattern: rulesets/java/[ruleset].xml, e.g. "comments" ruleset would be rulesets/java/comments.xml. So when defining a rule reference, you have to put that path there, e.g. <rule ref="rulesets/java/android.xml"/>.

The default rulesets are bundled inside the core JAR of the plugin, which for IDEA 15 is located at ~/.IdeaIC15/config/plugins/PMD-Intellij/lib/pmd-core-5.4.1.jar

More info on PMD custom rules here.

Comments

Popular Posts