Add pmd xml migration recipe - #1111
Draft
sullis wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's changed?
PMD 7 removed a batch of Java rules, and PMD fails on a
<rule ref>it cannot resolve. So a PMD 6 ruleset that references any of them stops the build outright after upgrading to PMD 7, one unresolvablerefat a time.This adds
PmdXml6to7Migration, an XML recipe that updates a PMDrulesetfile for PMD 7:errorprone.xml/DataflowAnomalyAnalysis→bestpractices.xml/UnusedAssignment,AvoidFinalLocalVariable,AvoidUsingShortType,CloneThrowsCloneNotSupportedException,SimplifyStartsWith), since leaving them behind is what breaks PMD 7,UseAssert*InsteadOf*rules becomeSimplifiableTestAssertion) or when the ruleset already selects it,<properties>on a rule it repoints.becomes
A replacement is inserted in
reforder relative to the rules already there, taking the indentation of its neighbor. Rules that aren't being replaced are never reordered, so a ruleset that happens to be unsorted stays as its author wrote it.Two things are deliberately left alone:
{Boolean,Byte,Integer,Long,Short}Instantiation,MIsLeadingVariableName,VariableNamingConventions) — picking one successor would silently change what the ruleset covers, so this leaves the choice to a human,ruleset, rather than matching arulesettag that happens to appear elsewhere.Also adds
rewrite-xmlto the build and registers the recipe inrecipes.csv.PMD project
https://docs.pmd-code.org/latest/index.html
https://github.com/pmd/pmd
Removed rules are listed in the PMD 7.0.0 release notes.