dart-lang / sdk
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 72,391 units with 841,939 lines of code in units (47.6% of code).
    • 93 very complex units (25,012 lines of code)
    • 338 complex units (38,983 lines of code)
    • 2,334 medium complex units (138,654 lines of code)
    • 5,051 simple units (147,116 lines of code)
    • 64,575 very simple units (492,174 lines of code)
2% | 4% | 16% | 17% | 58%
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
dart2% | 4% | 16% | 17% | 59%
cc4% | 5% | 18% | 18% | 53%
py<1% | 5% | 20% | 23% | 50%
js0% | 0% | 18% | 22% | 59%
h0% | 0% | 1% | 4% | 94%
java0% | 0% | 10% | 33% | 56%
c0% | 0% | 16% | 0% | 83%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
pkg3% | 4% | 17% | 18% | 56%
runtime3% | 4% | 16% | 16% | 58%
sdk1% | 4% | 13% | 15% | 64%
tools<1% | 4% | 21% | 21% | 51%
build0% | 5% | 18% | 28% | 46%
benchmarks0% | <1% | 1% | 4% | 93%
samples-dev0% | 0% | 3% | 17% | 79%
ROOT0% | 0% | 24% | 36% | 39%
samples_20% | 0% | 0% | 28% | 71%
utils0% | 0% | 0% | 23% | 76%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
void Simulator::DecodeSIMDDataProcessing()
in runtime/vm/simulator_arm.cc
439 256 1
ClassMembersNode build()
in pkg/front_end/lib/src/fasta/kernel/hierarchy/members_node.dart
794 202 0
bool FlowGraphInliner::TryInlineRecognizedMethod()
in runtime/vm/compiler/backend/inliner.cc
476 190 13
Future compile()
in pkg/compiler/lib/src/dart2js.dart
882 146 2
static TokenType binaryToAstTokenType()
in pkg/analyzer/lib/src/summary2/tokens_context.dart
290 143 1
static UnlinkedTokenType astToBinaryTokenType()
in pkg/analyzer/lib/src/summary2/tokens_writer.dart
289 143 1
void ARMDecoder::DecodeSIMDDataProcessing()
in runtime/vm/compiler/assembler/disassembler_arm.cc
128 135 1
bool _isNullabilityAwareSubtypeMatch()
in pkg/front_end/lib/src/fasta/type_inference/type_constraint_gatherer.dart
356 131 3
bool FlowGraphBuilder::IsRecognizedMethodForFlowGraph()
in runtime/vm/compiler/frontend/kernel_to_il.cc
144 130 1
void _doParse()
in sdk/lib/_http/http_parser.dart
389 125 0
void apply()
in pkg/compiler/lib/src/ir/impact_data.dart
333 104 1
int DisassemblerX64::TwoByteOpcodeInstruction()
in runtime/vm/compiler/assembler/disassembler_x86.cc
305 102 1
int DisassemblerX64::InstructionDecode()
in runtime/vm/compiler/assembler/disassembler_x86.cc
314 101 1
void generateHeader()
in pkg/front_end/tool/generate_ast_equivalence.dart
505 100 2
219 99 2
506 94 1
void Simulator::DecodeType7()
in runtime/vm/simulator_arm.cc
349 92 1
static bool canParse()
in pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart
391 88 2
bool _subtypeHelper()
in pkg/compiler/lib/src/elements/types.dart
203 86 4
factory HighlightRegionType()
in pkg/analyzer_plugin/lib/protocol/protocol_common.dart
165 81 1