dart-lang / linter
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 1,135 units with 10,856 lines of code in units (47.6% of code).
    • 0 very complex units (0 lines of code)
    • 2 complex units (140 lines of code)
    • 49 medium complex units (1,847 lines of code)
    • 106 simple units (2,141 lines of code)
    • 978 very simple units (6,728 lines of code)
0% | 1% | 17% | 19% | 61%
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% | 1% | 17% | 19% | 61%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
lib/src/rules0% | 1% | 16% | 18% | 63%
lib/src/util0% | 0% | 21% | 23% | 55%
lib/src0% | 0% | 20% | 12% | 67%
tool/canonical0% | 0% | 37% | 25% | 37%
tool0% | 0% | 9% | 29% | 60%
tool/bot0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
void visitParenthesizedExpression()
in lib/src/rules/unnecessary_parenthesis.dart
75 39 1
void _check()
in lib/src/rules/prefer_is_empty.dart
65 32 3
static bool unrelatedTypes()
in lib/src/util/dart_type_utilities.dart
53 23 3
bool isMountedCheck()
in lib/src/rules/use_build_context_synchronously.dart
60 22 2
void visitConstructorDeclaration()
in lib/src/rules/prefer_initializing_formals.dart
66 21 1
void _checkConstant()
in lib/src/rules/prefer_contains.dart
40 18 3
void visitInstanceCreationExpression()
in lib/src/rules/prefer_for_elements_to_map_fromIterable.dart
53 18 1
Future runLinter()
in lib/src/cli.dart
111 17 2
void visitConditionalExpression()
in lib/src/rules/prefer_null_aware_operators.dart
42 17 1
void visitLexeme()
in lib/src/rules/unnecessary_string_escapes.dart
43 17 6
DartType? getExpectedType()
in lib/src/rules/unnecessary_null_checks.dart
44 17 1
static EnumLikeClassDescription? asEnumLikeClass()
in lib/src/util/dart_type_utilities.dart
41 16 1
void visitInstanceCreationExpression()
in lib/src/rules/prefer_collection_literals.dart
30 16 1
bool _shouldSkipLinkedHashLint()
in lib/src/rules/prefer_collection_literals.dart
34 16 2
StringBuffer buildFooter()
in tool/scorecard.dart
55 16 2
StringBuffer buildFooter()
in tool/canonical/scorecard.dart
48 16 2
void visitNamedType()
in lib/src/rules/prefer_void_to_null.dart
31 15 1
void _check()
in lib/src/rules/void_checks.dart
23 15 4
void _visitClassOrMixin()
in lib/src/rules/public_member_api_docs.dart
47 15 1
void visitMethodInvocation()
in lib/src/rules/prefer_iterable_whereType.dart
35 15 1