Method is too deeply nested
objectscriptQuality release
Id
OS0021
Rule type
Code Smell
Severity
Critical
Critical
SQALE characteristic
- Changeability
- Logic
Remediation function
Constant/issue
Remediation cost
3d
This rule checks for the nesting depth of methods.
Methods which are too deeply nested are usually an indication that one, or several, of the below problems apply:
- the method tries to do too many things;
- objects used by this method lack isolation;
- the code in the method fails to account for early exit conditions.
The first of those conditions above is the most frequent one; the suggested fix is therefore to split the logic of this particular method into several methods.
Parameters
Name | Description | Default value |
---|---|---|
nestingThreshold
| Maximum allowed nesting depth
| 3
|