dart-lang / dart_style
Conditional Complexity

The distribution of complexity of units (measured with McCabe index).

Intro
  • Conditional complexity (also called cyclomatic complexity) is a term used to measure the complexity of software. The term refers to the number of possible paths through a program function. A higher value ofter means higher maintenance and testing costs (infosecinstitute.com).
  • Conditional complexity is calculated by counting all conditions in the program that can affect the execution path (e.g. if statement, loops, switches, and/or operators, try and catch blocks...).
  • Conditional complexity is measured at the unit level (methods, functions...).
  • Units are classified in four categories based on the measured McCabe index: 1-5 (simple units), 6-10 (medium complex units), 11-25 (complex units), 26+ (very complex units).
Learn more...
Conditional Complexity Overall
  • There are 404 units with 4,880 lines of code in units (80.4% of code).
    • 0 very complex units (0 lines of code)
    • 1 complex units (102 lines of code)
    • 24 medium complex units (1,128 lines of code)
    • 49 simple units (1,117 lines of code)
    • 330 very simple units (2,533 lines of code)
0% | 2% | 23% | 22% | 51%
Legend:
51+
26-50
11-25
6-10
1-5
Alternative Visuals
Conditional Complexity per Extension
51+
26-50
11-25
6-10
1-5
dart0% | 2% | 23% | 22% | 51%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
lib/src/cli0% | 28% | 28% | 0% | 42%
lib/src0% | 0% | 22% | 23% | 54%
lib/src/line_splitting0% | 0% | 26% | 43% | 30%
example0% | 0% | 57% | 0% | 42%
lib/src/rule0% | 0% | 16% | 16% | 68%
benchmark0% | 0% | 0% | 52% | 47%
tool0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
Future run()
in lib/src/cli/format_command.dart
102 31 0
void dumpChunks()
in lib/src/debug.dart
100 25 2
bool _fixSingleCascadeStatement()
in lib/src/source_visitor.dart
33 23 1
void writeComments()
in lib/src/chunk_builder.dart
65 23 3
bool writePrecedingCommentsAndNewlines()
in lib/src/source_visitor.dart
48 19 1
void visitAdjacentStrings()
in lib/src/source_visitor.dart
36 18 1
bool tryBind()
in lib/src/line_splitting/rule_set.dart
38 17 4
void _visitCollectionLiteral()
in lib/src/source_visitor.dart
59 16 5
void _calculateCost()
in lib/src/line_splitting/solve_state.dart
54 16 0
void visitIfElement()
in lib/src/source_visitor.dart
67 15 1
int? constrain()
in lib/src/rule/argument.dart
28 15 2
void visitFormalParameterList()
in lib/src/source_visitor.dart
60 14 2
bool _isWhitespace()
in lib/src/string_compare.dart
14 14 1
void _writeCommentText()
in lib/src/chunk_builder.dart
39 14 1
bool _forcesSplit()
in lib/src/call_chain_visitor.dart
27 13 1
static bool _isBlockFunction()
in lib/src/argument_list_visitor.dart
24 13 1
int _completeLine()
in lib/src/line_writer.dart
45 13 5
bool _isOverlapping()
in lib/src/line_splitting/solve_state.dart
28 13 1
void visit()
in lib/src/call_chain_visitor.dart
48 12 0
Expression _unwrapTarget()
in lib/src/call_chain_visitor.dart
22 12 2