facebookincubator / prometheus-configmanager
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 207 units with 2,703 lines of code in units (69.6% of code).
    • 0 very long units (0 lines of code)
    • 2 long units (149 lines of code)
    • 24 medium size units (660 lines of code)
    • 77 small units (1,200 lines of code)
    • 104 very small units (694 lines of code)
0% | 5% | 24% | 44% | 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% | 59% | 17% | 13% | 9%
go0% | 0% | 25% | 47% | 27%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ui/src0% | 59% | 17% | 13% | 9%
alertmanager/handlers0% | 0% | 38% | 53% | 8%
prometheus/alert0% | 0% | 20% | 47% | 31%
alertmanager/client0% | 0% | 12% | 50% | 36%
prometheus/handlers0% | 0% | 37% | 46% | 16%
prometheus0% | 0% | 100% | 0% | 0%
alertmanager/config0% | 0% | 25% | 39% | 35%
alertmanager0% | 0% | 100% | 0% | 0%
alertmanager/migration0% | 0% | 60% | 40% | 0%
restrictor0% | 0% | 0% | 56% | 43%
fsclient/mocks0% | 0% | 0% | 54% | 45%
fsclient0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
90 1 1
59 6 0
43 18 1
39 10 1
39 6 0
37 6 1
36 3 0
34 7 1
31 7 1
28 7 1
28 1 3
27 6 1
26 6 1
26 6 1
25 6 2
24 5 0
23 5 1
22 1 3
22 2 2
22 5 2
22 5 2
22 5 1
21 5 1
21 4 2
21 5 2
21 5 2
20 5 1
20 4 1
20 4 1
20 5 1
20 5 1
20 4 2
19 2 2
19 5 1
19 4 1
19 4 1
19 4 1
19 4 1
19 4 1
19 4 1
19 4 1
18 4 1
18 4 1
18 4 1
18 4 1
18 4 1
18 4 1
18 4 2
18 4 2
18 4 1