facebook / fbjs
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 335 units with 3,728 lines of code in units (63.5% of code).
    • 1 very long units (349 lines of code)
    • 3 long units (206 lines of code)
    • 25 medium size units (709 lines of code)
    • 88 small units (1,297 lines of code)
    • 218 very small units (1,167 lines of code)
9% | 5% | 19% | 34% | 31%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js9% | 5% | 19% | 34% | 31%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
eslint-config-fbjs100% | 0% | 0% | 0% | 0%
babel-preset-fbjs0% | 100% | 0% | 0% | 0%
fbjs/src0% | 2% | 18% | 39% | 39%
fbjs-scripts/gulp0% | 49% | 20% | 19% | 11%
babel-preset-fbjs/plugins0% | 0% | 48% | 31% | 20%
fbjs0% | 0% | 0% | 85% | 14%
fbjs-scripts/jest0% | 0% | 0% | 76% | 23%
fbjs-eslint-utils0% | 0% | 0% | 86% | 13%
eslint-config-fbjs/utils0% | 0% | 0% | 86% | 13%
signedsource0% | 0% | 0% | 40% | 60%
fbjs-scripts/babel0% | 0% | 0% | 0% | 100%
fbjs-scripts/node0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
349 1 0
71 11 1
69 30 4
66 7 3
46 5 1
45 7 0
39 8 2
35 18 2
35 20 1
34 18 3
33 7 1
29 9 1
28 6 2
27 6 2
27 10 4
27 5 3
26 6 0
26 11 2
25 1 1
24 8 2
24 10 2
23 9 2
23 8 2
23 10 2
23 10 1
22 4 0
22 3 3
22 4 1
21 6 0
20 6 3
20 1 1
20 5 2
20 5 1
19 7 2
19 4 2
19 4 2
19 1 0
19 6 2
18 6 2
18 3 3
18 6 2
18 6 1
18 5 0
18 3 1
18 4 2
18 4 3
17 8 2
17 6 1
17 6 2
17 1 0