Pattern: Unmerged if
statement
Issue: -
Identifies nested if statements that can be combined into one.
Not passing:
/* 1 */
if (foo)
if (bar);
/* 2 */
if (foo) {
if (bar) {
}
}
/* 3 */
if (foo) {
} else {
if (bar) {
} else {
}
}
Passing:
/* 1 */
if (foo && bar);
/* 2 */
if (foo && bar) {
}
/* 3 */
if (foo) {
} else if (bar) {
} else {
}
if (foo) {
if (bar) {
} else {
}
}
if (foo) {
if (bar) {
}
} else {
}