bazelbuild / bazel-gazelle
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 501 units with 9,135 lines of code in units (46.6% of code).
    • 5 very long units (768 lines of code)
    • 27 long units (1,721 lines of code)
    • 115 medium size units (3,674 lines of code)
    • 122 small units (1,775 lines of code)
    • 232 very small units (1,197 lines of code)
8% | 18% | 40% | 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
go8% | 18% | 40% | 19% | 13%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
language12% | 14% | 44% | 18% | 9%
cmd15% | 21% | 34% | 19% | 8%
rule0% | 22% | 39% | 17% | 20%
merger0% | 46% | 29% | 24% | 0%
repo0% | 20% | 44% | 22% | 12%
internal0% | 36% | 11% | 17% | 34%
label0% | 47% | 0% | 23% | 29%
walk0% | 21% | 41% | 24% | 12%
resolve0% | 0% | 43% | 33% | 23%
testtools0% | 0% | 79% | 20% | 0%
config0% | 0% | 64% | 10% | 25%
pathtools0% | 0% | 51% | 33% | 14%
flag0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func()
in language/go/generate.go
223 63 1
func updateRepos()
in cmd/gazelle/update-repos.go
164 45 2
func runFixUpdate()
in cmd/gazelle/fix-update.go
139 31 3
func()
in language/go/config.go
133 43 1
func importReposFromModules()
in language/go/modules.go
109 26 1
func()
in cmd/gazelle/fix-update.go
96 30 1
func goFileInfo()
in language/go/fileinfo.go
88 26 2
func MapExprStrings()
in rule/expr.go
73 23 2
func fetchModule()
in cmd/fetch_repo/module.go
71 19 4
func()
in language/go/config.go
71 3 1
70 23 1
func main()
in internal/list_repository_tools_srcs.go
68 26 0
func FixLoads()
in merger/fix.go
66 18 2
func mergeDict()
in rule/merge.go
64 18 2
func ExprFromValue()
in rule/value.go
64 16 1
func migrateNamingConvention()
in language/go/fix.go
64 31 2
func parseGoEmbed()
in language/go/fileinfo.go
64 14 2
func parse()
in cmd/fetch_repo/module.go
63 17 1
func detectNamingConvention()
in language/go/config.go
63 20 2
func squashDict()
in rule/merge.go
62 15 2