New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[core] Deprecate some syntax for ruleset references #3958
[core] Deprecate some syntax for ruleset references #3958
Conversation
Some undocumented ruleset reference forms are deprecated: - java-basic (resolves to rulesets/java/basic.xml), refs pmd#2352 - 641 (resolves to rulesets/releases/641.xml) Also using `<rule ref="rset1.xml,rset2.xml">` is deprecated. As before, only the first ruleset is considered, but now the rest is not ignored silently. Refs pmd#2612
Another change is that the error in case of unresolved ruleset doesn't just dump the entire classpath, which is unreadable. Instead the classpath is logged with a debug level at the start of execution.
Generated by 🚫 Danger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Let me know, if I should merge it or you want to do it...
@@ -539,7 +546,7 @@ private void parseRuleSetReferenceNode(RuleSetBuilder ruleSetBuilder, Element ru | |||
// load the ruleset with minimum priority low, so that we get all rules, to be able to exclude any rule | |||
// minimum priority will be applied again, before constructing the final ruleset | |||
RuleSetFactory ruleSetFactory = toLoader().filterAbovePriority(RulePriority.LOW).warnDeprecated(false).toFactory(); | |||
RuleSet otherRuleSet = ruleSetFactory.createRuleSet(RuleSetReferenceId.parse(ref).get(0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah... here we silently used only the first reference :)
@@ -85,12 +76,21 @@ | |||
@Deprecated | |||
@InternalApi | |||
public class RuleSetReferenceId { | |||
|
|||
// todo this class has issues... What is even an "external" ruleset? | |||
// terminology and API should be clarified. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep in mind at some point we marked it as InternalApi.
Clarification should happen anyway of course...
"Ruleset reference '" + tempRuleSetFileName + "' uses a deprecated form, use '" | ||
+ builtinRuleSet + "' instead" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Co-authored-by: Andreas Dangel <andreas.dangel@adangel.org>
They were merged on separate branches
Some undocumented ruleset reference forms are deprecated:
Also using
<rule ref="rset1.xml,rset2.xml">
is deprecated. As before, only the first ruleset is considered (which was undocumented), but now the rest is not ignored silently.I'll prepare the merge into PMD 7 and #3922 (which conflicts a lot).
Related issues
Ready?
./mvnw clean verify
passes (checked automatically by github actions)