6.2.7.1. CycleDetection-CallgraphCycles

Find cycles in the callgraph and report them as violations

Required inputs: RFG

This rule identifies cycles in the callgraph.

A cycle in the call graph bears the risk of infinite recursion at runtime if the termination of the calls is not guaranteed. As a consequence, the entire cycle has to be understood and all conditions must be managed simultaneously as to not induce runtime failure. At the same time, cycles impede understandability of the code for a developer.

If you want to include dynamic calls for function pointers and virtual calls, then manually activate StaticSemanticAnalysis.

If you need more advanced cycle detection features, use the rules inside the Graph-based Analyses/Cycles section in the Architecture group.

Possible Messages

This rule has no predefined messages.

Options

base_view_name

base_view_name : str = 'Call'

View to calculate the call cycles from.
 

consider_dynamic_calls

consider_dynamic_calls : bool = True

If you activate StaticSemanticAnalysis, dynamic calls for function pointers and virtual calls will be respected for cycle detection, unless you set this option to false.
 

generate_violation_previews

generate_violation_previews : bool = True

Whether to generate images of the cycle violations to be shown in the dashboard. This is an expensive operation and can be skipped to shorten the runtime of this rule.
 

pre_excludes

pre_excludes : set[bauhaus.analysis.config.GlobPattern] = set()

Set of globbing patterns of directories/filenames to exclude before the analysis is performed, i.e. no cycle is reported if the only connecting path goes through a node matching at least one pre_exclude entry
 

preview_edge_limit

preview_edge_limit : int = 1000

Maximum number of edges in a cycle for which a preview image should be generated.
 

preview_node_limit

preview_node_limit : int = 1000

Maximum number of nodes in a cycle for which a preview image should be generated.
 

selfloops

selfloops : bool = False

Whether only directly recursive elements should be reported as well.