primer / react
Unit Size

The distribution of size of units (measured in lines of code).

Intro
  • Unit size measurements show the distribution of size of units of code (methods, functions...).
  • Units are classified in four categories based on their size (lines of code): 1-20 (small units), 20-50 (medium size units), 51-100 (long units), 101+ (very long units).
  • You should aim at keeping units small (< 20 lines). Long units may become "bloaters", code that have increased to such gargantuan proportions that they are hard to work with.
Learn more...
Unit Size Overall
  • There are 263 units with 5,646 lines of code in units (26.5% of code).
    • 7 very long units (1,358 lines of code)
    • 14 long units (1,019 lines of code)
    • 55 medium size units (1,725 lines of code)
    • 56 small units (852 lines of code)
    • 131 very small units (692 lines of code)
24% | 18% | 30% | 15% | 12%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
tsx27% | 16% | 31% | 13% | 10%
ts0% | 23% | 29% | 28% | 18%
js0% | 38% | 12% | 28% | 20%
rb0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src24% | 18% | 30% | 14% | 11%
script0% | 0% | 29% | 31% | 39%
codemods0% | 0% | 42% | 50% | 7%
ROOT0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
231 17 1
230 17 1
229 17 1
227 17 1
223 17 1
117 1 0
101 20 5
95 1 0
87 20 6
82 25 3
78 2 0
78 2 0
75 4 0
74 2 0
74 2 0
70 2 0
69 2 0
66 2 0
59 2 0
57 3 0
55 2 0
50 2 0
49 2 0
47 6 0
45 3 0
43 6 2
42 1 0
42 4 0
41 1 0
40 1 0
40 1 0
40 1 0
39 1 0
39 3 0
38 2 1
37 2 0
37 1 0
37 7 4
36 9 2
36 5 0
35 1 0
34 1 0
32 2 0
31 1 0
30 1 0
30 2 0
30 1 1
29 1 9
29 1 0
29 3 2