facebook / metro
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 662 units with 10,052 lines of code in units (44.0% of code).
    • 2 very long units (307 lines of code)
    • 24 long units (1,645 lines of code)
    • 118 medium size units (3,812 lines of code)
    • 160 small units (2,283 lines of code)
    • 358 very small units (2,005 lines of code)
3% | 16% | 37% | 22% | 19%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js3% | 16% | 37% | 22% | 19%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
packages/metro-transform-plugins37% | 9% | 23% | 16% | 11%
packages/metro0% | 19% | 41% | 20% | 18%
packages/metro-source-map0% | 27% | 20% | 29% | 22%
packages/metro-runtime0% | 28% | 46% | 14% | 10%
packages/metro-resolver0% | 25% | 34% | 25% | 14%
packages/metro-transform-worker0% | 21% | 18% | 42% | 17%
packages/metro-config0% | 25% | 23% | 23% | 27%
packages/metro-inspector-proxy0% | 0% | 90% | 0% | 9%
packages/metro-memory-fs0% | 0% | 32% | 38% | 28%
scripts0% | 0% | 42% | 37% | 20%
packages/metro-react-native-babel-transformer0% | 0% | 87% | 0% | 12%
packages/buck-worker-tool0% | 0% | 38% | 30% | 31%
packages/metro-symbolicate0% | 0% | 23% | 33% | 43%
packages/metro-cache0% | 0% | 28% | 38% | 32%
packages/metro-babel-register0% | 0% | 55% | 33% | 11%
eslint-rules0% | 0% | 31% | 31% | 36%
packages/metro-hermes-compiler0% | 0% | 62% | 20% | 16%
packages/metro-minify-uglify0% | 0% | 79% | 0% | 20%
packages/metro-babel-transformer0% | 0% | 100% | 0% | 0%
packages/metro-minify-terser0% | 0% | 78% | 0% | 21%
packages/metro-core0% | 0% | 0% | 53% | 46%
packages/ob10% | 0% | 0% | 52% | 47%
packages/metro-react-native-babel-preset0% | 0% | 0% | 0% | 100%
ROOT0% | 0% | 0% | 0% | 100%
packages/metro-cache-key0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
195 25 2
112 24 2
91 20 2
88 33 1
84 14 2
83 19 3
79 10 3
79 7 3
77 4 1
77 5 4
72 14 2
71 10 1
70 13 4
70 6 4
69 3 4
64 3 20
63 1 19
63 5 2
62 3 1
59 14 3
56 3 4
55 5 7
55 5 1
55 22 1
52 6 5
51 14 2
50 13 2
50 15 2
50 13 3
50 15 4
49 5 2
49 5 2
48 3 7
48 15 2
47 8 1
46 12 2
46 3 3
46 6 5
45 7 3
44 8 1
44 2 2
44 5 5
44 6 5
44 3 1
44 4 4
43 4 5
43 13 3
42 4 3
41 16 1
41 6 3