Function stress complexity exceeds threshold
The function stress complexity of a function is greater than the defined threshold
Since R2025a
Description
Polyspace® calculates the function stress complexity (FSC) using this equation:
FSC = Cyclomatic complexity ⋅ (Number of calling function ⋅ Number of called function)2
Polyspace reports a violation of this rule when the function stress complexity of a
function is greater than the defined threshold. For details about how Polyspace calculates this metric, see Function Stress
Complexity
.
Polyspace uses a default threshold of 10000 unless you specify a different
threshold. To specify a selection file where you can set the threshold, use the option
Set checkers by
file (-checkers-selection-file)
or Checkers
activation file (-checkers-activation-file)
.
When you import comments from previous analyses by using polyspace-comments-import
, Polyspace copies any review information on the code metric Function Stress
Complexity
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.
Risk
Exceeding the function stress complexity threshold indicates that the complexity of the internal structure and external connections of a function is higher than the acceptable threshold. Such a function makes your code more difficult to maintain because:
The function is internally complex and difficult to update.
Any update to the function requires follow-up changes to many upstream and downstream functions.
Fix
To fix this violation:
Refactor the function to reduce its cyclomatic complexity. This can require splitting a function into multiple functions.
A high level of complexity of the external connections of the function can indicate an architectural issue in your code. Redesign and refactor your code to reduce interdependency and mutual coupling of functions.
Examples
Check Information
Group: Software Complexity |
Language: C | C++ |
Acronym:
SC21
|
Default Threshold: 10000 |
Version History
Introduced in R2025a