facebook / flow
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 725 units with 10,105 lines of code in units (4.2% of code).
    • 4 very long units (592 lines of code)
    • 26 long units (1,786 lines of code)
    • 108 medium size units (3,476 lines of code)
    • 145 small units (2,116 lines of code)
    • 442 very small units (2,135 lines of code)
5% | 17% | 34% | 20% | 21%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js7% | 19% | 34% | 18% | 19%
c0% | 13% | 33% | 25% | 27%
rb0% | 0% | 35% | 43% | 21%
cc0% | 0% | 47% | 32% | 19%
h0% | 0% | 36% | 24% | 39%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
lib11% | 26% | 39% | 12% | 9%
new_website/src63% | 23% | 0% | 9% | 3%
packages/flow-dev-tools0% | 21% | 34% | 26% | 17%
src/heap0% | 22% | 19% | 20% | 36%
packages/eslint-plugin-fb-flow0% | 28% | 23% | 29% | 18%
website/_webpack0% | 10% | 30% | 20% | 38%
src/hack_forked0% | 7% | 47% | 30% | 14%
packages/flow-remove-types0% | 0% | 46% | 34% | 19%
packages/flow-upgrade0% | 0% | 85% | 12% | 2%
website/_plugins0% | 0% | 35% | 43% | 21%
packages/babel-plugin-transform-flow-enums0% | 0% | 84% | 0% | 15%
packages/flow-parser-bin0% | 0% | 47% | 32% | 19%
src/services0% | 0% | 65% | 34% | 0%
src/parser_utils0% | 0% | 40% | 22% | 36%
src/parser0% | 0% | 36% | 24% | 39%
newtests/unsupported_spread_args0% | 0% | 0% | 72% | 27%
newtests/lsp0% | 0% | 0% | 12% | 87%
packages/flow-enums-runtime0% | 0% | 0% | 26% | 73%
newtests/sketchy_null0% | 0% | 0% | 42% | 57%
src/common0% | 0% | 0% | 0% | 100%
js0% | 0% | 0% | 0% | 100%
newtests/jsx_pragma0% | 0% | 0% | 0% | 100%
newtests/autocomplete0% | 0% | 0% | 0% | 100%
newtests/array_literal_tuple_spread0% | 0% | 0% | 0% | 100%
newtests/tuples0% | 0% | 0% | 0% | 100%
newtests/dynamic_import0% | 0% | 0% | 0% | 100%
new_website/components0% | 0% | 0% | 0% | 100%
new_website0% | 0% | 0% | 0% | 100%
src0% | 0% | 0% | 0% | 100%
newtests/shadow0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
250 4 0
122 1 5
116 1 4
104 1 8
98 17 1
96 1 7
94 7 2
89 1 6
87 20 3
85 13 1
83 1 5
78 1 7
77 17 6
71 1 6
69 3 2
65 16 1
65 1 5
65 8 1
63 10 6
61 15 6
60 1 5
56 14 0
56 11 1
55 3 1
54 1 2
53 1 4
52 1 3
52 1 5
51 1 3
51 9 2
50 7 1
50 18 2
50 1 2
49 8 2
47 26 1
47 1 1
47 1 4
47 1 3
46 1 2
46 1 4
45 7 3
45 6 1
45 13 4
44 5 7
44 15 1
44 6 2
43 1 3
43 1 4
43 1 2
42 1 2