facebook / react
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 3,943 units with 74,410 lines of code in units (69.9% of code).
    • 7 very complex units (2,663 lines of code)
    • 74 complex units (12,716 lines of code)
    • 293 medium complex units (17,632 lines of code)
    • 354 simple units (11,484 lines of code)
    • 3,215 very simple units (29,915 lines of code)
3% | 17% | 23% | 15% | 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
js3% | 17% | 23% | 15% | 39%
cpp0% | 0% | 8% | 3% | 87%
h0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
packages/react-reconciler6% | 16% | 28% | 19% | 29%
packages/eslint-plugin-react-hooks32% | 12% | 20% | 17% | 17%
scripts/bench0% | 34% | 13% | 4% | 46%
fixtures/legacy-jsx-runtimes0% | 6% | 38% | 26% | 29%
scripts/jest0% | 35% | 0% | 16% | 47%
packages/shared0% | 26% | 8% | 11% | 53%
packages/react0% | 8% | 38% | 11% | 40%
fixtures/dom0% | 10% | 4% | 1% | 83%
scripts/rollup0% | 0% | 38% | 19% | 41%
fixtures/attribute-behavior0% | 0% | 12% | 4% | 83%
packages/scheduler0% | 0% | 21% | 19% | 59%
scripts/eslint-rules0% | 0% | 37% | 26% | 35%
fixtures/fiber-debugger0% | 0% | 21% | 28% | 50%
scripts/release0% | 0% | 45% | 0% | 54%
packages/use-sync-external-store0% | 0% | 51% | 36% | 11%
fixtures/flight0% | 0% | 16% | 7% | 76%
scripts/error-codes0% | 0% | 40% | 40% | 19%
packages/jest-react0% | 0% | 23% | 30% | 46%
scripts/perf-counters0% | 0% | 6% | 2% | 91%
scripts/merge-fork0% | 0% | 0% | 97% | 2%
scripts/flow0% | 0% | 0% | 73% | 26%
packages/dom-event-testing-library0% | 0% | 0% | 10% | 89%
scripts/eslint0% | 0% | 0% | 62% | 37%
fixtures/blocks0% | 0% | 0% | 20% | 79%
scripts/babel0% | 0% | 0% | 35% | 64%
scripts/shared0% | 0% | 0% | 69% | 30%
packages/create-subscription0% | 0% | 0% | 41% | 58%
scripts/print-warnings0% | 0% | 0% | 51% | 48%
scripts/devtools0% | 0% | 0% | 0% | 100%
fixtures/concurrent0% | 0% | 0% | 0% | 100%
fixtures/ssr20% | 0% | 0% | 0% | 100%
fixtures/stacks0% | 0% | 0% | 0% | 100%
fixtures/devtools0% | 0% | 0% | 0% | 100%
fixtures/nesting0% | 0% | 0% | 0% | 100%
fixtures/ssr0% | 0% | 0% | 0% | 100%
packages/react-dom0% | 0% | 0% | 0% | 100%
packages/use-subscription0% | 0% | 0% | 0% | 100%
scripts/tasks0% | 0% | 0% | 0% | 100%
fixtures/eslint0% | 0% | 0% | 0% | 100%
fixtures/packaging0% | 0% | 0% | 0% | 100%
fixtures/expiration0% | 0% | 0% | 0% | 100%
ROOT0% | 0% | 0% | 0% | 100%
fixtures/art0% | 0% | 0% | 0% | 100%
packages/react-devtools-shared0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 50 most complex units
Unit# linesMcCabe index# params
560 150 3
560 150 3
535 104 1
278 73 4
278 73 4
226 56 3
226 56 3
238 50 3
159 50 3
238 50 3
159 50 3
149 45 5
149 45 5
212 43 3
183 43 2
212 43 3
183 43 2
100 39 2
189 38 3
182 38 4
182 38 4
189 38 3
94 37 1
137 37 4
137 37 4
183 36 3
154 35 4
89 35 1
154 35 4
89 35 1
230 33 0
230 33 1
230 33 1
54 33 1
46 33 2
54 33 1
46 33 2
125 32 5
75 31 1
88 31 2
88 31 2
611 30 0
471 30 0
611 30 1
359 30 1
611 30 1
359 30 1
109 30 0
147 30 3
98 30 1