bazelbuild / rules_go
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 341 units with 7,686 lines of code in units (46.8% of code).
    • 11 very long units (1,707 lines of code)
    • 20 long units (1,307 lines of code)
    • 77 medium size units (2,544 lines of code)
    • 77 small units (1,160 lines of code)
    • 156 very small units (968 lines of code)
22% | 17% | 33% | 15% | 12%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go22% | 17% | 33% | 15% | 12%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
go/tools/builders23% | 19% | 35% | 11% | 9%
go/tools/releaser47% | 5% | 14% | 24% | 8%
go/tools/bazel_testing43% | 0% | 24% | 28% | 2%
go/tools/bazel0% | 43% | 28% | 4% | 24%
go/tools/bzltestutil0% | 33% | 37% | 14% | 14%
go/tools/bazel_benchmark0% | 21% | 57% | 5% | 14%
go/tools/gopackagesdriver0% | 0% | 38% | 23% | 37%
go/tools/windows-testrunner0% | 0% | 57% | 42% | 0%
go/tools/fetch_repo0% | 0% | 64% | 0% | 35%
go/tools/coverdata0% | 0% | 100% | 0% | 0%
go/tools/internal0% | 0% | 0% | 59% | 40%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func compileArchive()
in go/tools/builders/compilepkg.go
255 59 23
func upgradeDepDecl()
in go/tools/releaser/upgradedep.go
212 51 6
func compile()
in go/tools/builders/compile.go
159 36 1
func genTestMain()
in go/tools/builders/generate_test_main.go
154 34 1
func cgo2()
in go/tools/builders/cgo2.go
153 34 19
func runPrepare()
in go/tools/releaser/prepare.go
152 38 3
func runUpgradeDep()
in go/tools/releaser/upgradedep.go
142 37 3
func run()
in go/tools/builders/protoc.go
135 29 1
func setupWorkspace()
in go/tools/bazel_testing/bazel_testing.go
134 35 2
func link()
in go/tools/builders/link.go
106 25 1
func compilePkg()
in go/tools/builders/compilepkg.go
105 16 1
func stdlib()
in go/tools/builders/stdlib.go
94 19 1
func()
in go/tools/bzltestutil/test2json.go
88 27 1
func initRunfiles()
in go/tools/bazel/runfiles.go
88 21 0
func readGoInfo()
in go/tools/builders/read.go
84 28 2
func()
in go/tools/builders/read.go
83 30 1
func checkAnalysisResults()
in go/tools/builders/nogo_main.go
71 19 2
func parseGoEmbed()
in go/tools/builders/read.go
64 14 2
func run()
in go/tools/bazel_benchmark/bazel_benchmark.go
63 15 1
func readMetadata()
in go/tools/builders/pack.go
62 18 2