reactjs / pt-br.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,750 lines of code in units (28.8% of code).
    • 5 very long units (893 lines of code)
    • 7 long units (489 lines of code)
    • 30 medium size units (990 lines of code)
    • 64 small units (936 lines of code)
    • 85 very small units (442 lines of code)
23% | 13% | 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
js34% | 12% | 12% | 26% | 14%
tsx15% | 14% | 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/components52% | 18% | 9% | 14% | 5%
beta/src14% | 13% | 38% | 23% | 9%
src/pages94% | 0% | 0% | 4% | <1%
src/templates0% | 34% | 14% | 31% | 19%
beta/scripts0% | 0% | 44% | 45% | 9%
src0% | 0% | 28% | 51% | 20%
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 1 0
187 5 0
159 25 5
148 5 0
136 1 0
97 8 0
78 12 4
74 1 0
66 5 5
62 2 0
58 13 9
54 3 0
48 6 2
47 6 4
44 9 1
40 9 7
40 3 0
39 7 1
39 2 0
38 2 2
38 4 0
38 1 0
35 1 0
35 3 0
34 3 2
34 4 2
34 3 7
34 3 4
33 5 2
33 7 3
32 2 3
30 5 5
29 1 8
27 7 2
26 5 8
26 2 1
25 1 5
24 1 2
22 4 1
22 2 3
22 5 3
22 2 2
20 2 0
20 6 1
20 1 1
19 5 0
19 1 1
19 7 1
19 2 2
18 3 1