facebookincubator / oomd
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 402 units with 5,620 lines of code in units (38.6% of code).
    • 3 very long units (458 lines of code)
    • 12 long units (748 lines of code)
    • 61 medium size units (1,824 lines of code)
    • 84 small units (1,234 lines of code)
    • 242 very small units (1,356 lines of code)
8% | 13% | 32% | 21% | 24%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp6% | 15% | 33% | 22% | 23%
h18% | 0% | 28% | 21% | 31%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
oomd25% | 12% | 22% | 17% | 22%
oomd/plugins6% | 15% | 38% | 25% | 13%
oomd/config0% | 25% | 29% | 11% | 33%
oomd/util0% | 10% | 23% | 29% | 36%
oomd/plugins/systemd0% | 43% | 20% | 16% | 18%
oomd/engine0% | 0% | 69% | 15% | 14%
oomd/dropin0% | 0% | 53% | 24% | 22%
oomd/include0% | 0% | 24% | 27% | 48%
oomd/fixtures0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
224 47 2
124 2 1
110 18 3
79 16 1
79 12 2
73 17 3
63 13 2
62 13 2
60 9 1
59 15 2
59 14 1
56 11 1
56 14 2
51 6 3
51 8 1
48 1 1
47 8 1
47 7 2
47 11 1
47 12 1
46 11 3
44 12 1
43 5 3
42 10 3
41 4 2
40 6 1
38 8 1
38 6 0
38 9 1
36 10 0
34 5 4
33 4 2
33 7 0
32 10 1
31 9 1
31 8 1
31 8 1
30 7 3
30 4 1
30 10 2
30 10 1
30 7 1
29 5 3
28 12 2
28 6 2
26 5 1
26 6 1
26 6 1
26 6 0
26 6 1