openrewrite / openrewrite/rewrite-static-analysis
`RemoveUnused(Local)Parameter/RemoveUnusedParameters`
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 62
- Forks
- 112
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 40
Description
What problem are you trying to solve?
- https://github.com/spring-projects/spring-boot/pull/47694
- https://errorprone.info/bugpattern/UnusedVariable
It seems this one the missing in the "gang of four" handling all unused stuff.
- https://docs.openrewrite.org/recipes/staticanalysis/removeunusedprivatemethods
- https://docs.openrewrite.org/recipes/staticanalysis/removeunusedlocalvariables
- https://docs.openrewrite.org/recipes/staticanalysis/removeunusedprivatefields
Checking into localvars and fields it seems parameters are not taken care yet.
It should simply remove as happy path. Maybe some hybrid mode via opt in switch would help to keep public api stable by changing the name to unused to pass inspection and dont make a breaking change on top lvl.
Describe the solution you'd like
Have you considered any alternatives or workarounds?
Additional context
Are you interested in contributing this feature to OpenRewrite?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the existing RemoveUnusedPrivateMethods, RemoveUnusedLocalVariables, and RemoveUnusedPrivateFields recipes referenced in the issue, along with the Error Prone UnusedVariable guidance. Define handling for unused local and method parameters, including the proposed public-API compatibility option. Done means the recipe removes unused parameters in the supported happy path and preserves public API behavior when the compatibility mode is used.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100