GerritCodeReview / zoekt
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 454 units with 8,109 lines of code in units (80.3% of code).
    • 8 very long units (958 lines of code)
    • 27 long units (1,925 lines of code)
    • 89 medium size units (2,528 lines of code)
    • 108 small units (1,584 lines of code)
    • 222 very small units (1,114 lines of code)
11% | 23% | 31% | 19% | 13%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go11% | 23% | 31% | 19% | 13%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT13% | 18% | 20% | 23% | 23%
cmd/zoekt-repo-index51% | 0% | 47% | 0% | 1%
gitindex17% | 8% | 39% | 25% | 8%
cmd/zoekt-mirror-github48% | 0% | 20% | 21% | 9%
web21% | 43% | 18% | 9% | 7%
cmd/zoekt-indexserver26% | 0% | 41% | 26% | 4%
shards0% | 50% | 12% | 23% | 13%
query0% | 26% | 37% | 16% | 20%
cmd/zoekt-mirror-bitbucket-server0% | 48% | 47% | 0% | 3%
cmd/zoekt-webserver0% | 52% | 11% | 36% | 0%
cmd/zoekt-mirror-gerrit0% | 77% | 0% | 15% | 6%
cmd/zoekt-test0% | 64% | 17% | 10% | 7%
cmd/zoekt-mirror-gitlab0% | 64% | 20% | 15% | 0%
build0% | 12% | 62% | 9% | 14%
cmd/zoekt0% | 63% | 22% | 13% | 0%
cmd/zoekt-archive-index0% | 23% | 52% | 20% | 3%
cmd/zoekt-git-index0% | 100% | 0% | 0% | 0%
cmd/zoekt-mirror-gitiles0% | 34% | 46% | 18% | 0%
ctags0% | 0% | 51% | 37% | 10%
cmd/zoekt-index0% | 0% | 82% | 17% | 0%
cmd/zoekt-hg-index0% | 0% | 67% | 32% | 0%
cmd/zoekt-git-clone0% | 0% | 100% | 0% | 0%
cmd0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func()
in eval.go
165 34 1
func main()
in cmd/zoekt-repo-index/main.go
133 27 0
func IndexGitRepo()
in gitindex/index.go
123 30 1
func main()
in cmd/zoekt-mirror-github/main.go
117 27 0
func()
in web/snippets.go
109 22 1
func executeMirror()
in cmd/zoekt-indexserver/config.go
104 35 3
func()
in matchtree.go
104 26 1
func()
in read.go
103 22 1
func()
in shards/shards.go
99 20 1
func main()
in cmd/zoekt-mirror-bitbucket-server/main.go
95 21 0
func main()
in cmd/zoekt-webserver/main.go
94 21 0
func main()
in cmd/zoekt-mirror-gerrit/main.go
91 21 0
func compare()
in cmd/zoekt-test/main.go
87 23 3
func parseExpr()
in query/parse.go
87 30 1
func()
in web/server.go
86 16 1
func main()
in cmd/zoekt-mirror-gitlab/main.go
79 16 0
func()
in shards/shards.go
71 11 1
func runCTags()
in build/ctags.go
71 17 2
func nextToken()
in query/parse.go
71 17 1
func()
in web/server.go
71 13 1