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] Support global rules that report at the end of analysis #3920

Open
oowekyala opened this issue Apr 15, 2022 · 1 comment
Open

[core] Support global rules that report at the end of analysis #3920

oowekyala opened this issue Apr 15, 2022 · 1 comment
Labels
a:RFC A drafted proposal on changes to PMD, up for feedback form the team and community an:enhancement An improvement on existing features / rules
Milestone

Comments

@oowekyala
Copy link
Member

Note I don't expect this idea to be implemented as is, but the use case is worth describing. See the "alternatives" section.

Is your feature request related to a problem? Please describe.
Some unseful rules could be written if we had infrastructure to report violations at the end of the analysis, giving the rule a global view on the analysed project.

In particular, CPD could be made a PMD rule (depends on #3919) using this infrastructure. Other copy-paste detection mechanisms could be written using this logic (eg tree-based copy detection).

Describe the solution you'd like
TBD, key concerns are

  • memory usage: global rules shouldn't keep direct references to AST nodes
  • rendering: renderers are all written with the assumption that once a file is closed, no more violations can be reported on it. This assumption is also baked into the new FileAnalysisListener API...

Describe alternatives you've considered
This might be unfeasible as-is given the difficulty about renderers stated above. Maybe we should instead support rules that work in 2 passes (indexing + actual analysis).

Additional context

See also #3355 for a rejected proposal.

@oowekyala oowekyala added an:enhancement An improvement on existing features / rules a:RFC A drafted proposal on changes to PMD, up for feedback form the team and community labels Apr 15, 2022
@oowekyala oowekyala added this to the 7.0.0 milestone Apr 15, 2022
@oowekyala oowekyala mentioned this issue Apr 15, 2022
55 tasks
@oowekyala oowekyala changed the title [cpd] Support global rules that report at the end of analysis [core] Support global rules that report at the end of analysis Apr 15, 2022
@oowekyala oowekyala removed this from the 7.0.0 milestone Apr 15, 2022
@adangel adangel added this to the 7.0.0 milestone Jan 9, 2023
@adangel adangel modified the milestones: 7.0.0, 7.x Jan 23, 2023
@oowekyala oowekyala mentioned this issue Feb 16, 2023
5 tasks
@NilsBaumgartner1994
Copy link

Would appreciate this as it is necessary for detecting data clumps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:RFC A drafted proposal on changes to PMD, up for feedback form the team and community an:enhancement An improvement on existing features / rules
Projects
None yet
Development

No branches or pull requests

3 participants