Modernize a PMD ruleset

MSAL

Bring a PMD ruleset XML file up to date with current PMD, by updating the <rule> references and <exclude> elements to name each rule as PMD knows it today. This runs both the PMD 6 to 7 migration, which replaces the rules PMD 7 deleted and drops the ones deleted without a successor, and the PMD 7 rule renames, which adopt the current name of each rule PMD renamed within the PMD 7 line. Rules whose replacement requires a judgement call, either because PMD split one rule across several successors or because the successor reports something different, are left alone. The result requires PMD 7.27.0 or later; an earlier PMD 7 fails to load a name that its version does not know yet.

org.openrewrite.java.pmd.ModernizePmd
mod run . --recipe=org.openrewrite.java.pmd.ModernizePmd

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

Recipe list

It runs these recipes, in this order.

  1. Migrate a PMD 6 ruleset to PMD 7
  2. Rename PMD rules that were renamed within the PMD 7 line