golang / vulndb
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 193 units with 3,225 lines of code in units (16.1% of code).
    • 1 very long units (105 lines of code)
    • 10 long units (677 lines of code)
    • 38 medium size units (1,191 lines of code)
    • 50 small units (727 lines of code)
    • 94 very small units (525 lines of code)
3% | 20% | 36% | 22% | 16%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go3% | 20% | 36% | 22% | 16%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
internal/report23% | 31% | 20% | 10% | 14%
internal/worker0% | 22% | 36% | 21% | 19%
internal/database0% | 55% | 26% | 12% | 5%
devtools/cmd0% | 51% | 35% | 13% | 0%
cmd/vulnreport0% | 0% | 76% | 12% | 10%
cmd/worker0% | 0% | 45% | 46% | 8%
internal/cvelistrepo0% | 0% | 61% | 28% | 9%
internal/gitrepo0% | 0% | 34% | 54% | 10%
internal/cveschema0% | 0% | 66% | 33% | 0%
internal/issues0% | 0% | 0% | 50% | 49%
internal0% | 0% | 0% | 76% | 23%
internal/derrors0% | 0% | 0% | 0% | 100%
cmd/dbdiff0% | 0% | 0% | 0% | 100%
internal/stdlib0% | 0% | 0% | 0% | 100%
cmd/gendb0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func()
in internal/report/lint.go
105 46 1
func Generate()
in internal/database/generate.go
94 27 3
func ToCVE()
in internal/report/cve.go
86 9 1
func triageV4CVE()
in internal/worker/triage.go
79 17 3
func()
in internal/worker/update.go
77 20 1
func CreateIssues()
in internal/worker/worker.go
64 12 4
func()
in internal/worker/update.go
63 12 1
func run()
in devtools/cmd/populate_firestore/populate_firestore.go
57 12 1
func CVEToReport()
in internal/report/cve.go
54 12 2
func loadDB()
in internal/database/load.go
52 14 1
func NewServer()
in internal/worker/server.go
51 7 2
func main()
in cmd/vulnreport/main.go
50 13 0
func main()
in cmd/worker/main.go
50 8 0
func GenerateOSVEntry()
in internal/database/generate.go
49 11 3
func ReadTxtarRepo()
in internal/gitrepo/gitrepo.go
42 11 2
func updateDB()
in devtools/cmd/populate_firestore/populate_firestore.go
39 11 5
func checkModVersions()
in internal/report/lint.go
39 12 2
func()
in internal/worker/update.go
39 9 1
func UpdateCommit()
in internal/worker/worker.go
39 9 6
func readVulnDB()
in internal/worker/worker.go
36 6 1