facebook / wdt
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 723 units with 10,015 lines of code in units (65.1% of code).
    • 6 very long units (896 lines of code)
    • 21 long units (1,488 lines of code)
    • 111 medium size units (3,444 lines of code)
    • 142 small units (2,089 lines of code)
    • 443 very small units (2,098 lines of code)
8% | 14% | 34% | 20% | 20%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp9% | 16% | 36% | 22% | 15%
h0% | 0% | 11% | 2% | 85%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT13% | 14% | 32% | 18% | 21%
util5% | 14% | 36% | 23% | 20%
bench0% | 27% | 36% | 17% | 19%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
233 41 0
183 36 2
133 32 0
119 19 0
117 15 2
111 20 0
99 26 3
91 20 1
90 14 0
86 13 2
84 15 0
82 17 0
82 14 2
78 15 2
76 13 0
73 11 0
72 13 0
66 12 3
63 12 1
63 11 0
60 9 1
57 11 2
54 10 2
54 11 0
53 8 2
53 9 0
52 9 0
50 14 4
48 9 0
48 14 5
48 9 2
47 7 1
45 8 4
45 8 2
44 11 4
43 9 2
42 8 2
41 5 0
41 8 2
41 8 2
40 6 3
40 7 0
40 8 0
39 8 1
39 10 2
39 7 2
39 6 4
39 15 5
39 6 0
38 9 2