-
Type:
Code Smell Detection
-
Status: Active
-
Resolution: Unresolved
-
Labels:
-
Message:
-
Highlighting:
-
List of parameters:
-
Default Severity:Critical
-
Impact:High
-
Likelihood:Low
-
Legacy Key:too-deeply-nested-if-statements, NestedIfDepth, NestedIf, COBOL.IfStatementNestedUsageCheck
-
Targeted languages:TypeScript, VB6
-
Covered Languages:ABAP, C#, C, C++, Cobol, Flex, Go, Java, JavaScript, Kotlin, Objective-C, PHP, PL/I, PL/SQL, Python, RPG, Ruby, Scala, Swift, T-SQL, VB.Net
-
Irrelevant for Languages:HTML, XML
-
Remediation Function:Constant/Issue
-
Constant Cost:10min
-
Analysis Level:Syntactic Analysis
-
Analysis Scope:Main Sources, Test Sources
-
Common Rule:Yes
-
Checkstyle:NestedForDepth, NestedIfDepth, NestedTryDepth
-
ESLint:max-depth
-
PMD:AvoidDeeplyNestedIfStmts
Nested if, for, while, switch, and try statements are key ingredients for making what's known as "Spaghetti code".
Such code is hard to read, refactor and therefore maintain.
- is implemented by
-
SONARVBSIX-235 Rule: Control flow statements "if", "for", "while", "switch" and "try" should not be nested too deeply
-
- Open
-
-
CPP-369 Rule: Avoid deeply nested if statements
-
- Closed
-
-
SONARPY-14 Rule: Control flow statements ["if", "for", "while", "switch" and "try"|"IF", "CASE", "DO", "LOOP", "SELECT", "WHILE" and "PROVIDE"] should not be nested too deeply
-
- Closed
-
-
SONARRPG-1 Rule: Control flow statements should not be nested too deeply
-
- Closed
-
-
SONARSLANG-10 Rule S134: Control flow statements "if", "for", "while", "switch" and "try" should not be nested too deeply
-
- Closed
-
-
SONARSLANG-222 [Scala] Enable Rule: S134 Control flow statements "if", "for", "while", "switch" and "try" should not be nested too deeply
-
- Closed
-
-
SONARSLANG-319 [Apex] Enable Rule: S134 Control flow statements "if", "for", "while", "switch" and "try" should not be nested too deeply
-
- Closed
-
-
SONARSWIFT-51 Rule: Control flow statements should not be nested too deeply
-
- Closed
-
-
SONARTSQL-96 Rule: Control flow statements "if", "while" and "try" should not be nested too deeply
-
- Closed
-
-
CPP-707 Create Objective-C rules repository containing targeted rules
-
- Closed
-
-
SONARSLANG-428 [Go] Enable rule S134: Control flow statements "if", "for", "while", "switch" and "try" should not be nested too deeply
-
- Closed
-
-
CPP-458 Update rule "Avoid deeply nested if statements" to also take into account "for", "while" and "switch" statements
-
- Closed
-
-
SONARABAP-210 Merge rules "Avoid deeply nested IF/DO statements" and "Avoid deeply nested SELECT"
-
- Closed
-
-
SONARCOBOL-996 Update rule "Avoid too many nested IF" to make it work with all control flow statements
-
- Closed
-
-
SONARCOBOL-1581 S134: Add a message on the secondary location
-
- Closed
-
- is related to
-
SONARFLEX-61 S134: Consider try-statement
-
- Open
-
-
RSPEC-3358 Ternary operators should not be nested
- Active
-
RSPEC-1684 "PERFORM" statements should not be deeply nested
- Closed
-
RSPEC-1821 "switch" statements should not be nested
- Active
- relates to
-
SONARPLI-109 Support every control flow statement in rule "NestedIfDepth"
-
- Open
-
- links to