The documentation of rule S1481 shows a compliant example of another rule.
Hi,
Thanks for letting us know. Our developers should have this patched very soon.
Thx,
Ann
1 Like
Hi! I had one follow up question to this rule. Do you suggest anything for unused local variables in an enhanced for-loop? For example,
import java.util.List;
List<String> list = List.of("aman", "sharma");
for (String s: list) {
System.out.println("Hello World!");
}
Hey @aman,
Sorry for the late reply but we are in the middle of reviewing some of our rules. Why do you think the compliant example is not suitable here?
For reference, in cases it changes in the meantime, I am seeing the following code samples
// Noncompliant
public int numberOfMinutes(int hours) {
int seconds = 0; // seconds is never used
return hours * 60;
}
// Compliant
public int numberOfMinutes(int hours) {
return hours * 60;
}
Cheers,
Dorian
I think it was fixed before you commented. But you may close this issue.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.