Metric-HIS.VG

HIS v(G) metric: Cyclomatic complexity

Required inputs: RFG

Computes the number of nodes in the control flow graph of a routine that have more than one outgoing edge.

For nodes originating in switch-statements, each nonempty case section is counted. It is also known as cyclomatic complexity.

Roughly speaking, the value Metric.McCabe_Complexity is computed by summing up

  • the number of if-statements,
  • the number of loop statements (e.g. for and while),
  • the number of conditional (?) operators,
  • the number of catch clauses, and
  • the number of nonempty case-sections
  • plus the value one.

So Metric.McCabe_Complexity is always greater zero.

Possible Messages

This rule has no predefined messages.

Options

alias_name

alias_name : str = 'Metric.HIS.VG'

Name under which the metric will be reported. In the RFG, a metric with this value is created, too (copied from original metric).
 

display_name

display_name : str | None = 'HIS v(G)'

Description of the metric shown in the dashboard. If None, rfg_metric_name is used.
 

max_value

max_value : int | None = 10

Maximum allowed value. None if unlimited.
 

min_value

min_value : int | None = 1

Minimum allowed value. None if unlimited.
 

rfg_metric_name

rfg_metric_name : OriginalMetrics = 'Metric.McCabe_Complexity'

Name of the node attribute storing the metric value in the RFG. The name of the RFG node attribute of the original metric. This name is searched in the RFG.
 

Option Types

These types are used by options listed above:

OriginalMetrics

An enumeration.
 
  • Metric.McCabe_Complexity

  • Metric.Extended_McCabe

  • Metric.Switch_Complexity