Skip to content
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

Merged
merged 10 commits into from May 28, 2022

Conversation

oowekyala
Copy link
Member

@oowekyala oowekyala commented May 7, 2022

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?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Complete build ./mvnw clean verify passes (checked automatically by github actions)
  • Added (in-code) documentation (if needed)

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.
@oowekyala oowekyala added is:deprecation The main focus is deprecating public APIs or rules, eg to make them internal, or removing them in:ruleset-xml About the ruleset schema/parser labels May 7, 2022
@oowekyala oowekyala added this to the 6.46.0 milestone May 7, 2022
@pmd-test
Copy link

pmd-test commented May 17, 2022

1 Message
📖 Compared to master:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
Full report
Compared to master:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
Full report
Compared to master:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
Full report

Generated by 🚫 Danger

Copy link
Member

@adangel adangel left a 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));
Copy link
Member

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.
Copy link
Member

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...

Comment on lines +200 to +201
"Ruleset reference '" + tempRuleSetFileName + "' uses a deprecated form, use '"
+ builtinRuleSet + "' instead"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@adangel adangel merged commit 16df537 into pmd:master May 28, 2022
@oowekyala oowekyala deleted the issue2352-ruleset-deprecations branch May 29, 2022 21:26
oowekyala added a commit to adangel/pmd that referenced this pull request Jul 16, 2022
They were merged on separate branches
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in:ruleset-xml About the ruleset schema/parser is:deprecation The main focus is deprecating public APIs or rules, eg to make them internal, or removing them
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[core] Deprecate <lang>-<ruleset> hyphen notation for ruleset references
3 participants