Remove unused local variables
MSALIf a local variable is declared but not used, it is dead code and should be removed. Unused variables increase cognitive load for readers who must determine whether the variable matters, and they may signal incomplete implementations or missed refactoring.
org. openrewrite. staticanalysis. RemoveUnusedLocalVariablesOptional
An array of variable identifier names for local variables to ignore, even if the local variable is unused. Separate values with commas.
A fully qualified class name. Only unused local variables whose type matches this will be removed. If empty or not set, all unused local variables are considered for removal.
Whether to remove unused local variables despite side effects in the initializer. Default false.
mod run . --recipe= org. openrewrite. staticanalysis. RemoveUnusedLocalVariablesInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.