Deeply nested if statements are hard to read and so to maintain.
The following code snippet illustrates this rule with the default threshold of 3 :
function sayHello() {
if (true) {
if (true) {
if (true) {
if (true) { // Non-Compliant
return;
} else {
return;
}
} else if (true) { // Compliant
if (true) { // Non-Compliant
return;
}
}
}
}
}