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

[java] Add support for exclusions to a few rules #3589

Open
nkavian opened this issue Oct 27, 2021 · 3 comments
Open

[java] Add support for exclusions to a few rules #3589

nkavian opened this issue Oct 27, 2021 · 3 comments
Labels
an:enhancement An improvement on existing features / rules

Comments

@nkavian
Copy link

nkavian commented Oct 27, 2021

Is your feature request related to a problem? Please describe.
Example: I want to enforce a minimum length of 4 for ShortClassName, ShortMethodName, ShortVariable, but my project has a few exceptions. I do not want:

  • to disable the rule,
  • to lower the minimum,
  • to use // NOPMD in so many places

Describe the solution you'd like
I'd like support for an exclusions parameter similar to FieldNamingConventions where exceptions to the rule can be provided.

Describe alternatives you've considered
I've lowered my minimum to 2 until this can be addressed.

Additional context
PMD is awesome.

@nkavian nkavian added the an:enhancement An improvement on existing features / rules label Oct 27, 2021
@jsotuyod
Copy link
Member

jsotuyod commented Nov 7, 2021

Are you looking to ignore complete files or to whitelist some specific short names for the whole codebase?

I believe that ignoring complete files could be useful at a base-rule level (and could help to bring PMD into pre-existing codebases), but if you want to whitelist any method called or regardless of the class it is in, then this wouldn't suffice.

@nkavian
Copy link
Author

nkavian commented Nov 7, 2021

Correct, specific method names across the code base. Sorry if my description wasn't clear. It was crystal clear in my mind when I wrote it, lol.

I'm looking for the same behavior of exclusions on FieldNamingConventions, to be applied to the other 3 rules.

@adamhibbert
Copy link

I'd like to do the same, for instance 'id' as a variable is common in my codebase, but I'd like to set ShortVariable minimum to 3, but have had to reduce it to 2 to get around this.

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
Projects
None yet
Development

No branches or pull requests

3 participants