Commit 860a7a8
authored
(Sonar) Fix "Unused local variables should be removed" (#342)
## Remediation
This change fixes the following Sonar rule: "Unused local variables
should be removed" (id =
[java:S1481](https://rules.sonarsource.com/java/RSPEC-1481))
## Details
This change removes unused variables. Unused variables make the code
harder to read, which will lead to confusion and bugs. We only remove
variables that have no state-changing effects.
Our changes look something like this:
```diff
catch (final UnsolvedSymbolException e) {
- String errorMessage = "An unexpected exception happened";
LOG.error("Problem resolving type of : {}", expr, e);
return false;
}
```
<details>
<summary>More reading</summary>
*
[https://rules.sonarsource.com/java/RSPEC-1481/](https://rules.sonarsource.com/java/RSPEC-1481/)
</details>
I have additional improvements ready for this repo! If you want to see
them, leave the comment:
```
@pixeebot next
```
... and I will open a new PR right away!
Powered by: [pixeebot](https://docs.pixee.ai/) (codemod ID:
[sonar:java/remove-unused-local-variable-s1481](https://docs.pixee.ai/codemods/java/sonar_java_remove-unused-local-variable-s1481))

<!--{"type":"DRIP","codemod":"sonar:java/remove-unused-local-variable-s1481"}-->
Co-authored-by: pixeebot[bot] <104101892+pixeebot[bot]@users.noreply.github.com>1 parent d827745 commit 860a7a8
File tree
1 file changed
+0
-1
lines changed- plugins/codemodder-plugin-maven/src/main/java/io/codemodder/plugins/maven/operator
1 file changed
+0
-1
lines changedLines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
270 | | - | |
271 | 270 | | |
272 | 271 | | |
273 | 272 | | |
| |||
0 commit comments