Skip to content

[doc] Generate a "all rules with default properties" ruleset per lang…#4208

Closed
adangel wants to merge 1 commit into
pmd:masterfrom
adangel:doc-export-all-rules-with-defaults
Closed

[doc] Generate a "all rules with default properties" ruleset per lang…#4208
adangel wants to merge 1 commit into
pmd:masterfrom
adangel:doc-export-all-rules-with-defaults

Conversation

@adangel

@adangel adangel commented Nov 11, 2022

Copy link
Copy Markdown
Member

…uage

Describe the PR

This generates for each language a sample ruleset file, which contains all rules with their properties and their default values explicitly mentioned.

This generated ruleset can be a useful basis to create a custom ruleset.

Sample generated ruleset for java

TODO:

  • Document, that this is available in "creating rulesets"
  • Document, that it is non-sense to enable all rules at once, since the rules might contradict each other. One should comment out the rules, not needed
  • Update release notes

Note:

  • This file is not suitable for other tools (like IDEs) for modifying rulesets: the types of the properties are missing, and for enums e.g. the possible values
  • Therefore the file is mostly useful for humans
  • A diff between versions could be created automatically thus comparing default values/new rules between versions

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)

@adangel adangel added the in:documentation Affects the documentation [doc] label Nov 11, 2022
@adangel adangel added this to the 6.52.0 milestone Nov 11, 2022
@ghost

ghost commented Nov 11, 2022

Copy link
Copy Markdown
1 Message
📖 No regression tested rules have been changed.

Generated by 🚫 Danger

@oowekyala

Copy link
Copy Markdown
Member

The way I understand the ticket #4187, it's about rendering an arbitrary user ruleset in a fully explicit form, to show how PMD understands it. I imagine a pmd resolve-ruleset command could be written directly with the existing RulesetWriter with little effort. OTOH this PR implements a more specific solution, and tbh I'm not convinced it's desirable to pregenerate rulesets with all rules like that... I would prefer not to encourage users to enable every rule they can -that's why we have the quickstart rulesets, and partly why we split categories from rulesets.

A utility to explicitize rulesets could technically also be used to implement the same thing you do in this PR (pmd resolve-ruleset rulesets/internal/all-java.xml) but it would be more generally useful, eg in the case of #4187 where OP wants to check what changed in their ruleset specifically. Another use case is to communicate with eg a future PMD ruleset editor GUI, which I believe we talked about to prepare gsoc a few years ago.

@adangel

adangel commented Nov 22, 2022

Copy link
Copy Markdown
Member Author

Let's move this for now at least to 6.53.0 - I won't have time to continue working on this.

Agreed - it won't fix the original issue (#4187) - that's why these are not linked. It could serve as a viable workaround. Not sure if it's worth continuing this path. However, you only get feedback, once it's out there. We could create it in 6.53.0 as experimental and remove it again in 6.54.0 if we get negative feedback or no feedback at all...

@adangel

adangel commented Jan 23, 2023

Copy link
Copy Markdown
Member Author

I'm closing this as won't fix. We should consider a solution together with #4295 after PMD 7 is out.

@adangel adangel closed this Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in:documentation Affects the documentation [doc]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants