facebookincubator / OnlineSchemaChange
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 390 units with 4,739 lines of code in units (69.4% of code).
    • 3 very long units (560 lines of code)
    • 5 long units (353 lines of code)
    • 54 medium size units (1,591 lines of code)
    • 66 small units (956 lines of code)
    • 262 very small units (1,279 lines of code)
11% | 7% | 33% | 20% | 26%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py11% | 7% | 33% | 20% | 26%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
core/commands65% | 0% | 13% | 5% | 15%
core/lib/sqlparse12% | 17% | 27% | 22% | 20%
core/lib/payload4% | 5% | 46% | 19% | 22%
core/lib0% | 0% | 7% | 27% | 64%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
291 1 2
155 55 2
114 5 3
84 33 2
78 14 3
74 26 1
59 21 1
58 12 1
50 21 1
50 13 2
47 13 1
44 4 3
43 10 1
42 16 1
40 16 3
40 9 2
38 11 1
38 9 1
37 15 1
35 5 3
34 16 3
33 8 1
33 7 1
32 17 2
32 22 2
31 14 1
31 8 1
30 5 1
29 4 1
29 7 2
29 3 3
28 1 2
27 12 1
27 10 1
27 5 1
27 5 1
27 8 1
26 9 1
26 3 1
26 3 1
25 5 1
25 8 1
24 9 2
24 3 1
24 4 1
24 8 2
24 6 2
24 5 1
24 4 2
23 8 2