facebook / jest
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,126 units with 20,570 lines of code in units (48.3% of code).
    • 2 very complex units (520 lines of code)
    • 10 complex units (1,891 lines of code)
    • 60 medium complex units (4,148 lines of code)
    • 104 simple units (3,985 lines of code)
    • 950 very simple units (10,026 lines of code)
2% | 9% | 20% | 19% | 48%
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
ts2% | 10% | 20% | 19% | 46%
js0% | 0% | 12% | 12% | 74%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
packages/jest-config46% | 0% | 10% | 16% | 26%
packages/jest-mock0% | 76% | 7% | 4% | 11%
packages/jest-core0% | 16% | 27% | 8% | 46%
packages/jest-runner0% | 48% | 20% | 0% | 31%
packages/jest-haste-map0% | 10% | 24% | 17% | 47%
packages/expect-utils0% | 62% | 0% | 0% | 37%
packages/expect0% | 0% | 30% | 22% | 47%
packages/jest-jasmine20% | 0% | 18% | 13% | 68%
packages/jest-reporters0% | 0% | 33% | 23% | 43%
packages/jest-runtime0% | 0% | 23% | 33% | 43%
packages/jest-diff0% | 0% | 57% | 23% | 19%
packages/jest-cli0% | 0% | 70% | 0% | 29%
packages/jest-transform0% | 0% | 18% | 35% | 45%
packages/pretty-format0% | 0% | 19% | 35% | 44%
packages/jest-repl0% | 0% | 100% | 0% | 0%
scripts0% | 0% | 22% | 21% | 56%
packages/jest-util0% | 0% | 24% | 11% | 63%
packages/jest-environment-node0% | 0% | 79% | 0% | 20%
packages/jest-snapshot0% | 0% | 9% | 44% | 45%
website/src0% | 0% | 6% | 5% | 87%
packages/jest-get-type0% | 0% | 100% | 0% | 0%
packages/jest-resolve0% | 0% | 0% | 50% | 49%
packages/jest-worker0% | 0% | 0% | 15% | 84%
packages/jest-circus0% | 0% | 0% | 59% | 40%
packages/jest-docblock0% | 0% | 0% | 82% | 17%
packages/jest-matcher-utils0% | 0% | 0% | 45% | 54%
packages/diff-sequences0% | 0% | 0% | 69% | 30%
packages/jest-environment-jsdom0% | 0% | 0% | 61% | 38%
packages/jest-watcher0% | 0% | 0% | 38% | 61%
packages/babel-jest0% | 0% | 0% | 15% | 84%
packages/jest-fake-timers0% | 0% | 0% | 0% | 100%
packages/jest-each0% | 0% | 0% | 0% | 100%
packages/babel-plugin-jest-hoist0% | 0% | 0% | 0% | 100%
packages/jest-console0% | 0% | 0% | 0% | 100%
packages/jest-changed-files0% | 0% | 0% | 0% | 100%
packages/jest-validate0% | 0% | 0% | 0% | 100%
packages/jest-leak-detector0% | 0% | 0% | 0% | 100%
packages/jest-create-cache-key-function0% | 0% | 0% | 0% | 100%
packages/test-utils0% | 0% | 0% | 0% | 100%
packages/jest-source-map0% | 0% | 0% | 0% | 100%
packages/jest-phabricator0% | 0% | 0% | 0% | 100%
website0% | 0% | 0% | 0% | 100%
packages/jest-message-util0% | 0% | 0% | 0% | 100%
packages/jest-serializer0% | 0% | 0% | 0% | 100%
packages/jest-expect0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 50 most complex units
Unit# linesMcCabe index# params
453 119 4
67 59 1
106 46 6
333 42 6
237 31 6
177 31 1
184 29 2
180 29 2
176 29 2
172 29 3
165 29 2
161 29 2
90 24 6
107 24 4
110 23 1
106 23 1
108 23 4
71 22 3
142 22 5
199 21 2
33 20 2
98 19 1
69 19 8
80 18 2
93 18 3
74 17 1
113 17 1
36 17 1
85 17 1
76 17 2
78 17 1
61 16 4
64 16 4
89 16 1
39 16 2
35 16 1
60 16 0
59 16 3
64 15 1
103 15 5
45 15 2
92 15 2
100 14 5
46 14 1
34 14 1
61 14 3
24 14 1
56 13 1
61 13 2
26 13 2