anthropics / claude-cookbooks
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 436 units with 7,108 lines of code in units (16.3% of code).
    • 0 very complex units (0 lines of code)
    • 7 complex units (773 lines of code)
    • 24 medium complex units (1,069 lines of code)
    • 75 simple units (1,962 lines of code)
    • 330 very simple units (3,304 lines of code)
0% | 10% | 15% | 27% | 46%
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
py0% | 12% | 15% | 26% | 44%
ts0% | 0% | 8% | 31% | 59%
c0% | 0% | 0% | 44% | 55%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
claude_agent_sdk0% | 24% | 12% | 32% | 30%
scripts0% | 41% | 26% | 21% | 11%
tool_use0% | 12% | 11% | 31% | 44%
skills0% | 0% | 16% | 15% | 67%
.claude0% | 0% | 32% | 32% | 34%
.github0% | 0% | 52% | 26% | 20%
managed_agents0% | 0% | 7% | 32% | 59%
capabilities0% | 0% | 7% | 28% | 64%
patterns0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 50 most complex units
Unit# linesMcCabe index# params
129 46 1
86 36 1
71 33 1
59 31 1
117 31 3
219 29 0
92 28 1
40 25 1
72 25 1
52 24 1
60 24 3
60 20 0
48 17 3
24 17 2
39 16 3
30 16 1
52 16 1
61 15 3
64 15 1
17 13 2
65 13 4
17 12 2
106 11 0
31 11 2
27 11 2
50 11 2
37 11 1
18 11 1
19 11 1
38 11 1
42 11 3
24 10 0
11 10 1
50 10 0
13 10 1
172 10 2
60 10 0
45 10 3
44 10 3
54 10 0
18 10 0
46 10 1
36 10 1
31 9 2
17 9 2
16 9 2
15 9 3
8 9 1
14 9 1
38 9 1