Replace a PMD rule in a ruleset
MSALUpdates <rule ref="..."/> references and <exclude name="..."/> elements in PMD ruleset XML files to name a rule's replacement. An <exclude> is only renamed when the replacement lives in the same ruleset file, because an exclusion can only name a rule from the ruleset its enclosing <rule> refers to; when the replacement moved to another ruleset file the exclusion no longer names a rule PMD knows, so it is removed instead.
org. openrewrite. java. pmd. ReplacePmdRuleRequired
The rule to replace, either a fully qualified reference such as category/java/errorprone.xml/MissingBreakInSwitch or just the rule name, in which case the rule is replaced regardless of which ruleset file it is referenced from.
The rule to replace it with. Give a fully qualified reference when the replacement lives in a different ruleset file; a bare rule name keeps the existing ruleset file.
mod run . --recipe= org. openrewrite. java. pmd. ReplacePmdRule \
-P oldRule= category/ java/ errorprone. xml/ MissingBreakInSwitch \
-P newRule= ImplicitSwitchFallThroughInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.