facebookincubator / fbender
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 219 units with 1,842 lines of code in units (62.7% of code).
    • 0 very long units (0 lines of code)
    • 1 long units (78 lines of code)
    • 17 medium size units (444 lines of code)
    • 38 small units (557 lines of code)
    • 163 very small units (763 lines of code)
0% | 4% | 24% | 30% | 41%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go0% | 4% | 24% | 30% | 41%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
cmd/core0% | 17% | 32% | 17% | 32%
tester0% | 0% | 36% | 17% | 46%
cmd/dhcpv40% | 0% | 49% | 15% | 35%
protocols/udp0% | 0% | 100% | 0% | 0%
utils0% | 0% | 42% | 22% | 34%
cmd0% | 0% | 39% | 46% | 13%
tester/dns0% | 0% | 53% | 0% | 46%
cmd/dns0% | 0% | 20% | 33% | 45%
flags0% | 0% | 8% | 28% | 63%
cmd/dhcpv60% | 0% | 23% | 17% | 58%
metric0% | 0% | 38% | 0% | 61%
tester/run0% | 0% | 0% | 84% | 15%
recorders0% | 0% | 0% | 74% | 25%
cmd/http0% | 0% | 0% | 59% | 40%
tester/dhcpv40% | 0% | 0% | 73% | 26%
cmd/tftp0% | 0% | 0% | 90% | 9%
cmd/udp0% | 0% | 0% | 100% | 0%
tester/dhcpv60% | 0% | 0% | 58% | 41%
tester/http0% | 0% | 0% | 0% | 100%
tester/tftp0% | 0% | 0% | 0% | 100%
tester/udp0% | 0% | 0% | 0% | 100%
log0% | 0% | 0% | 0% | 100%
ROOT0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
78 1 2
39 10 3
39 9 3
38 6 1
28 6 2
27 6 1
27 4 2
24 3 1
24 7 1
23 5 0
23 3 1
23 6 1
22 5 3
22 4 1
22 6 1
21 5 1
21 5 1
21 4 1
20 5 2
20 4 2
19 5 1
18 7 1
18 3 1
18 8 1
18 3 1
17 4 3
17 4 4
17 4 4
16 3 2
16 3 2
16 3 2
16 3 1
16 5 2
15 4 3
15 4 3
14 3 0
14 3 2
14 4 1
14 3 2
14 4 1
14 5 1
14 4 1
13 2 0
13 4 1
13 2 2
13 4 1
13 4 3
13 4 3
12 3 3
11 3 1