← All recipes
Moderne licensed

Remove a PMD rule from a ruleset

Recipe IDorg.openrewrite.java.pmd.RemovePmdRuleArtifactorg.openrewrite.recipe:rewrite-pmd

Removes both <rule ref="..."/> references to a rule and <exclude name="..."/> elements naming it from PMD ruleset XML files. Intended for rules that PMD deleted without offering a replacement, since PMD fails to load a ruleset that references a rule it does not know.

Single recipeMSAL

Usage

You’ll need the Moderne CLI configured before running the command below.

mod run . --recipe org.openrewrite.java.pmd.RemovePmdRule --recipe-option "rule=category/java/codestyle.xml/AvoidFinalLocalVariable"

If the recipe isn’t available locally, install it with:

mod config recipes jar install org.openrewrite.recipe:rewrite-pmd:RELEASE

Options

NameTypeDescription
rulerequiredStringThe rule to remove, either a fully qualified reference such as category/java/codestyle.xml/AvoidFinalLocalVariable or just the rule name, in which case the rule is removed regardless of which ruleset file it is referenced from.
e.g. category/java/codestyle.xml/AvoidFinalLocalVariable

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