Metric-ExtendedMcCabe¶
Extended 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.
Metric.Extended_McCabe differs from Metric.McCabe_Complexity in its treatment of short circuit logical operators: it also interprets these operators as resulting in control flow nodes having more than one outgoing edge and therefore adds also the number of shortcut operators (&& and ||) to the value.
Roughly speaking, the value Metric.Extended_McCabe 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,
- the number of nonempty case-sections, and
- the number of shortcut operators
- plus the value one.
So Metric.Extended_McCabe is always greater zero.
Possible Messages
This rule has no predefined messages.
Options¶
This rule shares the following common options: exclude_messages_in_system_headers, excludes, includes, justification_checker, post_processing, provider, severity
This rule shares the following common metric options: base_view_name, excluded_node_types, hierarchy_edge_name, hierarchy_view_name, propagate, report_all_values, report_propagated_values
The following places define options that affect this rule: Analysis-GlobalOptions
display_name¶
display_name : str | None = 'Extended Cyclomatic Complexity'
max_value¶
max_value : int | None = None
min_value¶
min_value : int | None = None
rfg_metric_name¶
rfg_metric_name : str = 'Metric.Extended_McCabe'