rewrite-static-analysis
rewrite-static-analysis copied to clipboard
TernaryOperatorsShouldNotBeNested does not handle assignments
TernaryOperatorsShouldNotBeNested is only implemented for return statements and lambdas, not assignments (or other possible places for ternaries).
sample
class Test {
public void doThing(String a, String b) {
String result = "a".equals(a) ? "a" : "b".equals(b) ? "b" : "nope";
System.out.println(result);
}
}
expected:
class Test {
public void doThing(String a, String b) {
String result;
if ("a".equals(a)) {
result = "a";
}
else {
result = "b".equals(b) ? "b" : "nope";
}
System.out.println(result);
}
}
actual: no change