The nesting depth of control structures in a function is greater than the defined nesting depth threshold of a function
This defect is raised when the nesting depth of control structures in a function, such as
for, if-else, switch, or
while, exceeds the defined nesting depth threshold. For details about how
Polyspace® calculates the nesting depth, see .
Polyspace uses the default threshold 4 unless you specify a threshold. To specify a
selection file where you can set the threshold, use Set checkers by file
(-checkers-selection-file) (Polyspace Bug Finder Server). Also see Reduce Software Complexity by Using Polyspace Checkers (Polyspace Bug Finder Server).
When you import comments from previous analyses by using , Polyspace copies any review information on the code metric in the previous result to this checker in the current result. If the current result contains the same code metric, the review information is copied to the code metric as well.
Violation of this checker might indicate that:
The function is difficult to read and understand.
The function performs too many tasks at once.
The function contains unexpected or unplanned development.
These factors make the module difficult to maintain and debug.
To fix this check, either refactor your code or change the checker threshold. When refactoring your code:
Design the function to perform a single task.
Delegate unrelated tasks to other functions.
A best practice is to check the complexity of a module early in development to avoid costly post-development refactoring.
| Group: Software Complexity |
| Language: C | C++ |
Acronym:
SC14
|
| Default Threshold: 4 |