Number of Call Levels
Depth of nesting of control flow statements
Description
Note
Use Bug Finder instead of Code Prover for computing code metrics. Support for computing code metrics in Code Prover will be removed in a future release. See Version History.
This metric specifies the maximum nesting depth of control flow statements such as
if
, switch
, for
, or
while
in a function. Polyspace® starts the count of nesting depth at 0
and each
additional nesting level increments this metric. A function without control-flow
statements has a call level 0.
You can start counting call levels from 1
instead of
0
by using the new command line option -start-level-from-one
.
The recommended upper limit for this metric is 4. For better readability of your code, try to enforce an upper limit for this metric.
To enforce limits on metrics, see Compute Code Complexity Metrics Using Polyspace.
Examples
Metric Information
Group: Function |
Acronym: LEVEL |
HIS Metric: Yes |