Sonar: Control flow statements “if”, “for”, “while”, “switch” and “try” should not be nested too deeply

Fixing “Refactor this code to not nest more than 3 if/for/while/switch/try statements.”

Sonar: Control flow statements “if”, “for”, “while”, “switch” and “try” should not be nested too deeply
JAVA: NestedIfDepth
Nested if, for, while, switch and try statements is a key ingredient for making what’s known as “Spaghetti code”. Such code is hard to read, refactor, and therefore maintain.