The language scope of a function is greater than the defined threshold
Language scope represents the cost of maintaining or updating a function. For instance, if an operand occurs many times in a function, then changing the operand name is costly. The language scope of such a function would be high. This defect is raised when the language scope of a function exceeds the defined threshold. For details about how Polyspace calculates language scope, see .
Note
The language scope calculated by Polyspace® is a floating point number. In this checker, the floating point language scope is converted to an integer by rounding it to the second decimal place and then multiplying it by 100.
Polyspace uses the default threshold 400 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:
Change to an operand might require many change in the function.
The function might be performing multiple tasks at once.
The function might have high degree of interdependency with other functions.
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 the code, design the functions in your code so that:
Each function performs one specific task.
The functions have minimal side effects on 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:
SC18
|
| Default Threshold: 400 |