avoid_nested_if
Severity | Quick Fix | Options |
---|---|---|
Warning | ❌ | ✅ |
Details
DO avoid too many nested if
statements.
Bad
if (x) {
if (y) {
if (z) {
doSomething();
}
}
}
Good
if (!x) return;
if (!y) return;
if (!z) return;
doSomething();
Severity | Quick Fix | Options |
---|---|---|
Warning | ❌ | ✅ |
DO avoid too many nested if
statements.
if (x) {
if (y) {
if (z) {
doSomething();
}
}
}
if (!x) return;
if (!y) return;
if (!z) return;
doSomething();