golang / net
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 2,227 units with 31,160 lines of code in units (53.3% of code).
    • 19 very long units (2,981 lines of code)
    • 62 long units (4,150 lines of code)
    • 358 medium size units (10,899 lines of code)
    • 432 small units (6,358 lines of code)
    • 1,356 very small units (6,772 lines of code)
9% | 13% | 34% | 20% | 21%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go9% | 13% | 34% | 20% | 21%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
html25% | 22% | 30% | 13% | 7%
webdav19% | 15% | 35% | 19% | 9%
http29% | 16% | 32% | 20% | 20%
internal6% | 2% | 37% | 24% | 29%
publicsuffix25% | 0% | 28% | 32% | 14%
bpf14% | 6% | 40% | 10% | 27%
idna0% | 37% | 17% | 20% | 24%
websocket0% | 24% | 31% | 22% | 21%
route0% | 13% | 62% | 7% | 16%
dns0% | 6% | 32% | 31% | 29%
icmp0% | 10% | 40% | 27% | 21%
trace0% | 8% | 29% | 22% | 39%
ipv40% | 3% | 38% | 21% | 36%
nettest0% | 0% | 67% | 20% | 11%
ipv60% | 0% | 25% | 24% | 50%
proxy0% | 0% | 54% | 13% | 31%
lif0% | 0% | 43% | 26% | 29%
dict0% | 0% | 78% | 19% | 2%
http0% | 0% | 26% | 29% | 43%
context0% | 0% | 21% | 31% | 47%
xsrftoken0% | 0% | 47% | 26% | 26%
netutil0% | 0% | 0% | 39% | 60%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func inBodyIM()
in html/parse.go
332 109 1
func isBadCipher()
in http2/ciphers.go
283 2 1
func()
in webdav/internal/xml/xml.go
261 81 1
func()
in webdav/internal/xml/read.go
233 86 1
func()
in html/token.go
188 50 1
func render1()
in html/render.go
153 57 2
func()
in webdav/internal/xml/xml.go
146 50 1
func main()
in html/atom/gen.go
135 37 0
func()
in internal/socks/client.go
129 34 1
func()
in http2/transport.go
127 40 1
func()
in webdav/internal/xml/marshal.go
125 42 1
func()
in webdav/internal/xml/marshal.go
122 49 1
func main1()
in publicsuffix/gen.go
121 62 0
func()
in http2/transport.go
111 34 1
func()
in bpf/instructions.go
108 38 1
func()
in html/token.go
102 30 1
func()
in http2/transport.go
102 27 1
func()
in http2/server.go
102 31 1
func()
in html/parse.go
101 26 1
func()
in http2/transport.go
99 25 1