Modernize a PMD ruleset
org.openrewrite.java.pmd.ModernizePmdArtifactorg.openrewrite.recipe:rewrite-pmdBring 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.
Usage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe org.openrewrite.java.pmd.ModernizePmdIf the recipe isn’t available locally, install it with:
mod config recipes jar install org.openrewrite.recipe:rewrite-pmd:RELEASEDefinition
This recipe runs the following recipes in order.
- Migrate a PMD 6 ruleset to PMD 7
org.openrewrite.java.pmd.Pmd6to7Migration - Rename PMD rules that were renamed within the PMD 7 line
org.openrewrite.java.pmd.Pmd7RuleRenames
Data tables
Structured output this recipe can produce.
- Source files that had resultsSource files that were modified by the recipe run.
org.openrewrite.table.SourcesFileResults - Source files that had search resultsSearch results that were found during the recipe run.
org.openrewrite.table.SearchResults - Source files that errored on a recipeThe details of all errors produced by a recipe run.
org.openrewrite.table.SourcesFileErrors - Recipe performanceStatistics used in analyzing the performance of recipes.
org.openrewrite.table.RecipeRunStats