rewrite-static-analysis
rewrite-static-analysis copied to clipboard
Replace nested ifs with one if and conditions joined with &&
What problem are you trying to solve?
Simplify code.
Describe the situation before applying the recipe
class A {
void foo(boolean a, boolean b) {
if (a) {
if (b) {
}
}
}
}
Describe the situation after applying the recipe
class A {
void foo(boolean a, boolean b) {
if (a && b) {
}
}
}
Things to take into account
- parenthesis might or might not be needed
- only applicable if there's no other logic in the outer
if
This issue is stale because it has not had any activity for 60 days. Remove question label or comment or this will be closed in two weeks. Issues may be reopened when there is renewed interest.