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] Commandline option to write the whole rulesets including default properties #4187

Open
PowerStat opened this issue Nov 2, 2022 · 1 comment
Labels
an:enhancement An improvement on existing features / rules in:cli Affects the PMD Command Line Interface

Comments

@PowerStat
Copy link

PowerStat commented Nov 2, 2022

Is your feature request related to a problem? Please describe.
From time to time (not regularly) I update my PMD configs. And then it is hard to find out what I have changed in my config and what you have changed.

Describe the solution you'd like
A commandline option to write the whole known rulesets including the default properties into a pmd-default.xml file.
This will allow me to have a simple diff between my configurations and your configuration with all its defaults.
This requires that you write out your configuration in a defined way, like first by programming language, then by section and then alphabetically. The properties should also written out alphabetically.
Also this might allow to automatically update the rules in a CI/CD context.

Describe alternatives you've considered
Verifying my config with your website rules section takes to much time and is too error prone!

Additional context
None

@PowerStat PowerStat added the an:enhancement An improvement on existing features / rules label Nov 2, 2022
@adangel
Copy link
Member

adangel commented Nov 3, 2022

Maybe as a first step, we could produce such a complete "pmd-default.xml" ruleset file while we generate the rule documentation. There we anyway need to go through each rule to query the properties and the default values to generate the rule documentation pages.
Then you could at least download this complete ruleset from the latest documentation.

A further step could be to move the logic to generate this complete ruleset file into pmd-core and maybe add a CLI option as you suggested. Then our rule-doc-generator could use this ruleset file to generate the rule docs.
But I think, the ruleset file needs to be generated and can't be prepared during build time in pmd-core, since pmd-core doesn't depend on the different language modules (dependencies are the other way round).
I think, it would be nice, to provide such a ruleset in a pre-generated manner somehow, so that consumers don't need to execute PMD in order to see the default rules (I'm thinking about plugins that integrate PMD into IDEs, build tools, etc.).

adangel added a commit to adangel/pmd that referenced this issue Nov 11, 2022
@adangel adangel changed the title Commandline option to write the whole rulesets including default properties. [core] Commandline option to write the whole rulesets including default properties Nov 11, 2022
@adangel adangel added the in:cli Affects the PMD Command Line Interface label Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
an:enhancement An improvement on existing features / rules in:cli Affects the PMD Command Line Interface
Projects
None yet
Development

No branches or pull requests

2 participants