reactjs / tg.reactjs.org
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 191 units with 3,795 lines of code in units (29.3% of code).
    • 5 very long units (896 lines of code)
    • 8 long units (544 lines of code)
    • 30 medium size units (993 lines of code)
    • 63 small units (918 lines of code)
    • 85 very small units (444 lines of code)
23% | 14% | 26% | 24% | 11%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js33% | 15% | 12% | 24% | 13%
tsx14% | 13% | 37% | 23% | 9%
ts0% | 0% | 63% | 26% | 9%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/components51% | 25% | 9% | 9% | 4%
beta/src14% | 13% | 38% | 24% | 9%
src/pages94% | 0% | 0% | 4% | <1%
src/templates0% | 34% | 14% | 31% | 19%
beta/scripts0% | 0% | 44% | 45% | 9%
src0% | 0% | 27% | 52% | 19%
scripts0% | 0% | 0% | 93% | 6%
src/utils0% | 0% | 0% | 70% | 29%
ROOT0% | 0% | 0% | 100% | 0%
beta/plugins0% | 0% | 0% | 34% | 65%
gatsby0% | 0% | 0% | 52% | 47%
beta/public0% | 0% | 0% | 0% | 100%
static/js0% | 0% | 0% | 0% | 100%
beta0% | 0% | 0% | 0% | 100%
plugins/gatsby-remark-header-custom-ids0% | 0% | 0% | 0% | 100%
plugins/gatsby-transformer-versions-yaml0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
263 2 0
186 5 0
159 25 5
152 5 0
136 1 0
97 8 0
78 12 4
74 1 0
66 5 5
62 2 0
58 13 9
55 1 0
54 3 0
48 6 2
47 6 4
44 9 1
40 9 7
40 3 0
39 2 0
38 2 2
38 4 0
38 1 0
35 1 0
35 5 0
35 3 0
34 3 2
34 4 2
34 3 4
33 5 2
33 4 7
33 7 3
32 2 3
32 3 6
30 5 5
29 1 8
27 7 2
26 5 8
26 2 1
25 1 2
22 4 1
22 2 3
22 5 3
22 3 2
20 2 0
20 3 0
20 6 1
20 1 1
19 5 0
19 1 1
18 3 1