Design Cyclomatic Complexity Breakdown
The design cyclomatic complexity is the number of possible execution paths through a design. In general, the more paths there are through a design, the more complex the design is. When you keep the design cyclomatic complexity low, the design typically is easier to read, maintain, and test. The design cyclomatic complexity is calculated as the number of decision paths plus one. The metric adds one to account for the execution path represented by the default path. The design cyclomatic complexity includes the default path because the metric identifies each possible outcome from an execution path, including the default outcome.
For example, the design cyclomatic complexity of an
is two because the
if statement represents one decision and the
else statement represents the default path. The default path is not
included in the number of decisions because no decision is
made to reach a default
function y = fcn(u) if u < 0 % one decision y = -1*u; else % default path % zero decisions y = u; end end
The Design Cyclomatic Complexity Breakdown section of the dashboard shows the sources of design cyclomatic complexity for a component or unit in your design.
In the Design Cyclomatic Complexity Breakdown section of the dashboard:
The Complexity column shows:
The Distribution column shows:
When you drill in to a widget in the Design Cyclomatic Complexity Breakdown section of the dashboard, you can view the Metric Details associated with the metrics for: