facebook / fbt
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 347 units with 4,507 lines of code in units (30.2% of code).
    • 0 very long units (0 lines of code)
    • 11 long units (814 lines of code)
    • 44 medium size units (1,345 lines of code)
    • 81 small units (1,185 lines of code)
    • 211 very small units (1,163 lines of code)
0% | 18% | 29% | 26% | 25%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js0% | 18% | 30% | 25% | 25%
java0% | 0% | 0% | 61% | 38%
mm0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
auto-param-new-string-helper0% | 72% | 18% | 8% | 0%
runtime/shared0% | 29% | 21% | 23% | 25%
packages/babel-plugin-fbt0% | 6% | 37% | 28% | 26%
packages/babel-plugin-standalone0% | 21% | 20% | 24% | 33%
demo-app/src0% | 80% | 0% | 0% | 19%
packages/babel-plugin-fbt-runtime0% | 61% | 20% | 0% | 17%
packages/fb-babel-plugin-utils0% | 0% | 28% | 39% | 31%
ROOT0% | 0% | 41% | 39% | 18%
packages/fb-tiger-hash0% | 0% | 23% | 42% | 33%
packages/default-collection-transform0% | 0% | 100% | 0% | 0%
packages/gulp-rewrite-flowtyped-modules0% | 0% | 40% | 0% | 59%
packages/react-native-fbt0% | 0% | 0% | 58% | 41%
runtime/nonfb0% | 0% | 0% | 51% | 48%
packages/gulp-strip-docblock-pragmas0% | 0% | 0% | 55% | 45%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
96 18 3
79 6 4
76 8 3
76 8 5
74 10 3
74 1 2
72 8 5
71 1 2
68 16 3
66 10 1
62 13 4
49 6 2
45 3 3
45 7 1
44 7 3
44 10 1
40 11 2
39 6 5
39 10 1
38 6 1
36 18 2
36 7 5
36 6 1
34 6 1
34 7 1
33 6 5
33 9 4
33 8 1
31 8 2
31 4 1
30 5 5
30 3 1
30 16 2
29 5 1
28 7 2
28 5 1
27 16 2
27 4 3
27 5 1
27 11 3
26 5 0
25 6 2
25 2 11
25 4 1
24 1 1
23 7 1
22 3 2
22 1 4
22 2 2
22 6 0