golang / mod
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 293 units with 4,756 lines of code in units (87.2% of code).
    • 2 very long units (249 lines of code)
    • 17 long units (1,128 lines of code)
    • 58 medium size units (1,728 lines of code)
    • 57 small units (881 lines of code)
    • 159 very small units (770 lines of code)
5% | 23% | 36% | 18% | 16%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go5% | 23% | 36% | 18% | 16%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
modfile9% | 27% | 35% | 13% | 14%
zip19% | 25% | 30% | 14% | 10%
sumdb0% | 36% | 32% | 20% | 10%
sumdb/note0% | 46% | 24% | 4% | 24%
sumdb/tlog0% | 14% | 31% | 40% | 14%
module0% | 9% | 46% | 21% | 21%
semver0% | 18% | 39% | 18% | 23%
sumdb/storage0% | 44% | 25% | 15% | 14%
gosumcheck0% | 0% | 76% | 0% | 23%
sumdb/dirhash0% | 0% | 86% | 0% | 13%
internal/lazyregexp0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func()
in modfile/rule.go
139 28 1
func checkFiles()
in zip/zip.go
110 30 1
func()
in sumdb/tlog/tile.go
98 25 1
func()
in sumdb/server.go
96 20 1
func checkZip()
in zip/zip.go
83 24 2
func()
in modfile/read.go
78 24 1
func()
in modfile/read.go
74 21 1
func parseReplace()
in modfile/rule.go
73 18 5
func Open()
in sumdb/note/note.go
70 23 2
func()
in sumdb/client.go
64 15 1
func()
in modfile/read.go
63 20 1
func Unzip()
in zip/zip.go
59 16 3
func checkElem()
in module/module.go
56 20 2
func parse()
in semver/semver.go
54 17 1
func TestStorage()
in sumdb/storage/test.go
53 11 3
func parseToFile()
in modfile/rule.go
53 12 4
func Sign()
in sumdb/note/note.go
52 12 2
func()
in sumdb/client.go
51 12 1
func()
in modfile/rule.go
51 10 1
func checkGoSum()
in gosumcheck/main.go
47 11 3