golang / image
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 613 units with 17,541 lines of code in units (11.8% of code).
    • 33 very long units (4,581 lines of code)
    • 58 long units (4,346 lines of code)
    • 168 medium size units (5,472 lines of code)
    • 135 small units (2,049 lines of code)
    • 219 very small units (1,093 lines of code)
26% | 24% | 31% | 11% | 6%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go26% | 24% | 31% | 11% | 6%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
draw45% | 29% | 19% | 4% | 1%
tiff47% | 10% | 26% | 9% | 6%
font6% | 27% | 36% | 19% | 9%
vp8l29% | 7% | 51% | 7% | 4%
webp54% | 0% | 38% | 0% | 6%
vp80% | 16% | 53% | 15% | 14%
bmp0% | 56% | 21% | 18% | 3%
vector0% | 28% | 28% | 29% | 14%
ccitt0% | 8% | 60% | 22% | 7%
example0% | 90% | 0% | 0% | 9%
riff0% | 48% | 25% | 23% | 2%
cmd0% | 0% | 76% | 20% | 3%
colornames0% | 0% | 65% | 12% | 22%
math0% | 0% | 18% | 40% | 41%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func expnDollar()
in draw/gen.go
465 83 4
func()
in tiff/reader.go
180 48 1
func()
in draw/impl.go
160 32 1
func()
in draw/impl.go
160 32 1
func()
in draw/impl.go
160 32 1
func()
in draw/impl.go
160 32 1
func()
in draw/impl.go
156 31 1
func()
in draw/impl.go
156 31 1
func()
in draw/impl.go
156 31 1
func()
in draw/impl.go
156 31 1
func()
in font/sfnt/postscript.go
145 40 1
func Encode()
in tiff/writer.go
129 30 3
func()
in draw/impl.go
127 13 1
func Decode()
in tiff/reader.go
127 36 1
func()
in draw/impl.go
123 12 1
func()
in draw/impl.go
123 25 1
func inversePredictor()
in vp8l/transform.go
123 22 3
func()
in draw/impl.go
121 13 1
func()
in draw/impl.go
121 25 1
func newDecoder()
in tiff/reader.go
120 31 1