Next: , Previous: Syntax Metrics Control, Up: Switches for gnatmetric


14.1.5 Complexity Metrics Control

For a program unit that is an executable body (a subprogram body (including generic bodies), task body, entry body or a package body containing its own statement sequence ) gnatmetric computes the following complexity metrics:

The McCabe complexity metrics are defined in www.mccabe.com/pdf/nist235r.pdf

According to McCabe, both control statements and short-circuit control forms should be taken into account when computing cyclomatic complexity. For each body, we compute three metric values:

When computing cyclomatic and essential complexity, gnatmetric skips the code in the exception handlers and in all the nested program units.

By default, all the complexity metrics are computed and reported. For more finely-grained control you can use the following switches:

-nocc
Do not compute the McCabe Cyclomatic Complexity
-noec
Do not compute the Essential Complexity
-nonl
Do not compute maximal loop nesting level
-ne
Do not consider exit statements as gotos when computing Essential Complexity