Add a PMD rule to a ruleset

MSAL

Adds a <rule ref="..."/> reference to PMD ruleset XML files that do not have one yet. When the ruleset already pulls in the whole ruleset file the rule lives in, the rule is enabled by removing the <exclude name="..."/> that was keeping it out rather than by adding a second reference to it.

org.openrewrite.java.pmd.AddPmdRule

Required

The rule to add, as a fully qualified reference naming both the ruleset file and the rule within it. A bare rule name is not enough, since PMD resolves a rule through the ruleset file it lives in.

mod run . --recipe=org.openrewrite.java.pmd.AddPmdRule \ -P rule=category/java/errorprone.xml/EmptyCatchBlock

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.