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] Merge rules MethodArgumentCouldBeFinal and LocalVariableCouldBeFinal #4938

Open
oowekyala opened this issue Apr 6, 2024 · 0 comments
Labels
an:enhancement An improvement on existing features / rules

Comments

@oowekyala
Copy link
Member

Is your feature request related to a problem? Please describe.

  • The rules have near identical implementation; in fact LocalVariableCouldBeFinal uses methods of the other rule.
  • The rule MethodArgumentCouldBeFinal is misnamed. It doesn't report only methods, but also constructors. To be pedantic the word argument is not appropriate as we are reporting formal parameters.

Describe the solution you'd like
Merge both rules into a new VariableCouldBeDeclaredFinal rule. The new rule can also care about other kinds of variables, probably by adding properties to check different kinds of vars (in future developments).

Describe alternatives you've considered
Just rename MethodArgumentCouldBeFinal to FormalParameterCouldBeFinal. This would not allow us to merge the implementations and would require us to add new rules for other kinds of variables, which has a lot of overhead.

Additional context
Add any other context about the feature request here.

@oowekyala oowekyala added the an:enhancement An improvement on existing features / rules label Apr 6, 2024
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

1 participant