facebook / jscodeshift
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 144 units with 1,571 lines of code in units (81.0% of code).
    • 0 very long units (0 lines of code)
    • 3 long units (242 lines of code)
    • 11 medium size units (361 lines of code)
    • 30 small units (440 lines of code)
    • 100 very small units (528 lines of code)
0% | 15% | 22% | 28% | 33%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js0% | 15% | 22% | 28% | 33%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src0% | 14% | 27% | 26% | 31%
src/collections0% | 24% | 11% | 32% | 32%
src/utils0% | 0% | 0% | 100% | 0%
parser0% | 0% | 0% | 0% | 100%
utils0% | 0% | 0% | 0% | 100%
sample0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
96 27 2
77 18 1
69 23 1
46 9 3
45 13 1
42 7 2
38 8 2
36 9 2
32 8 1
30 15 1
26 6 3
23 4 2
22 5 1
21 4 2
19 6 2
18 2 5
18 7 1
18 5 1
18 7 1
18 5 1
18 5 2
17 6 1
17 3 1
16 7 4
16 5 2
15 6 2
15 3 1
15 3 1
15 3 1
15 7 3
15 5 1
14 3 1
14 5 2
14 1 1
13 3 0
12 6 1
12 3 1
12 1 1
11 3 1
11 3 1
11 2 1
11 2 0
11 3 1
11 1 3
10 2 3
10 2 5
10 3 2
10 4 0
10 1 2
10 3 1