reactjs / th.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 68 units with 1,461 lines of code in units (21.5% of code).
    • 3 very long units (599 lines of code)
    • 3 long units (213 lines of code)
    • 4 medium size units (139 lines of code)
    • 23 small units (329 lines of code)
    • 35 very small units (181 lines of code)
40% | 14% | 9% | 22% | 12%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js40% | 14% | 9% | 22% | 12%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/components55% | 19% | 10% | 9% | 5%
src/pages94% | 0% | 0% | 4% | <1%
src/templates0% | 34% | 14% | 31% | 19%
src0% | 0% | 28% | 51% | 20%
scripts0% | 0% | 0% | 93% | 6%
src/utils0% | 0% | 0% | 70% | 29%
ROOT0% | 0% | 0% | 100% | 0%
gatsby0% | 0% | 0% | 52% | 47%
static/js0% | 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
264 1 0
186 5 0
149 5 0
97 8 0
62 2 0
54 3 0
40 3 0
39 2 0
38 1 0
22 3 2
20 6 1
20 1 1
19 7 1
18 3 1
18 1 1
17 1 1
16 4 0
14 3 1
14 2 1
14 3 3
13 3 2
13 3 3
13 1 2
13 3 1
13 4 2
12 4 0
12 2 0
12 1 1
12 1 1
12 1 1
12 1 0
11 5 2
11 2 0
10 1 1
10 3 1
10 3 1
10 3 1
10 1 2
7 2 1
7 3 0
7 2 2
7 1 0
6 2 3
6 1 1
6 1 2
6 1 1
5 1 2
5 1 2
5 2 2
5 2 1