anthropics / claude-agent-sdk-demos
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 360 units with 8,630 lines of code in units (56.1% of code).
    • 0 very complex units (0 lines of code)
    • 6 complex units (798 lines of code)
    • 32 medium complex units (2,698 lines of code)
    • 43 simple units (1,633 lines of code)
    • 279 very simple units (3,501 lines of code)
0% | 9% | 31% | 18% | 40%
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
ts0% | 7% | 20% | 20% | 51%
tsx0% | 12% | 57% | 14% | 15%
py0% | 14% | 35% | 21% | 28%
js0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
email-agent0% | 11% | 25% | 21% | 41%
excel-demo0% | 5% | 61% | 2% | 30%
simple-chatapp0% | 0% | 43% | 10% | 46%
research-agent0% | 0% | 45% | 27% | 27%
resume-generator0% | 0% | 43% | 0% | 56%
hello-world0% | 0% | 0% | 100% | 0%
ask-user-question-previews0% | 0% | 0% | 29% | 70%
hello-world-v20% | 0% | 0% | 21% | 78%
Most Complex Units
Top 50 most complex units
Unit# linesMcCabe index# params
151 48 2
291 45 1
135 41 1
61 36 2
69 36 2
91 27 1
82 25 2
282 24 2
52 23 1
116 21 2
74 21 1
29 21 1
47 21 3
118 20 2
150 20 1
61 19 1
167 18 0
38 17 1
117 17 2
53 17 2
145 16 0
29 15 2
37 14 3
109 14 1
79 14 2
77 14 1
50 13 1
22 13 1
94 13 3
83 12 1
81 12 1
96 12 8
99 12 1
46 11 3
55 11 2
81 11 2
61 11 2
68 11 1
16 10 4
17 10 2
51 10 1
54 10 1
37 10 2
38 10 1
49 10 0
26 9 2
35 9 8
81 9 2
34 9 2
46 8 1