facebook / time
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 583 units with 8,231 lines of code in units (69.9% of code).
    • 1 very long units (110 lines of code)
    • 21 long units (1,514 lines of code)
    • 91 medium size units (2,736 lines of code)
    • 139 small units (2,010 lines of code)
    • 331 very small units (1,861 lines of code)
1% | 18% | 33% | 24% | 22%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go1% | 18% | 33% | 24% | 22%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ptp/simpleclient21% | 10% | 32% | 15% | 19%
cmd/ntpcheck0% | 30% | 33% | 18% | 17%
ptp/ptp4u0% | 29% | 24% | 21% | 24%
cmd/ziffy0% | 29% | 41% | 15% | 13%
ntp/chrony0% | 25% | 8% | 26% | 40%
cmd/ptp4u0% | 100% | 0% | 0% | 0%
cmd/ptpcheck0% | 13% | 47% | 25% | 13%
cmd/ntpresponder0% | 100% | 0% | 0% | 0%
leapsectz0% | 37% | 27% | 23% | 11%
cmd/pshark0% | 48% | 0% | 23% | 28%
ntp/responder0% | 12% | 32% | 25% | 29%
ptp/protocol0% | 4% | 41% | 28% | 25%
phc0% | 0% | 55% | 40% | 3%
calnex/cert0% | 0% | 87% | 12% | 0%
calnex/config0% | 0% | 76% | 10% | 12%
calnex/api0% | 0% | 22% | 51% | 25%
calnex/export0% | 0% | 77% | 22% | 0%
ntp/control0% | 0% | 20% | 35% | 43%
calnex/firmware0% | 0% | 82% | 0% | 18%
leaphash0% | 0% | 100% | 0% | 0%
calnex/cmd0% | 0% | 20% | 44% | 35%
timestamp0% | 0% | 10% | 47% | 41%
oscillatord0% | 0% | 0% | 40% | 59%
ntp/protocol0% | 0% | 0% | 23% | 76%
ntp/shm0% | 0% | 0% | 0% | 100%
cmd/calnex0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
110 26 1
91 14 3
89 16 1
87 16 0
86 17 1
85 16 0
81 15 1
80 16 2
78 15 1
76 10 0
73 4 1
71 12 1
69 14 2
68 15 1
67 20 1
64 12 2
62 12 1
60 19 1
58 17 1
58 13 1
56 14 1
55 17 1
50 6 2
50 16 4
48 11 1
47 7 1
47 15 4
46 3 1
46 8 1
45 12 1
44 9 1
43 8 1
43 9 1
41 7 1
41 6 1
41 10 4
40 11 1
40 10 1
40 11 4
39 5 6
38 9 1
37 10 1
37 13 1
36 10 1
35 8 1
35 12 1
34 8 1
33 9 1
33 7 1
32 1 2