bazelbuild / buildtools
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 1,099 units with 14,715 lines of code in units (62.1% of code).
    • 11 very long units (2,846 lines of code)
    • 21 long units (1,487 lines of code)
    • 123 medium size units (3,781 lines of code)
    • 205 small units (2,909 lines of code)
    • 739 very small units (3,692 lines of code)
19% | 10% | 25% | 19% | 25%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go19% | 10% | 25% | 19% | 25%
js0% | 0% | 69% | 0% | 30%
ts0% | 0% | 0% | 81% | 18%
py0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
build47% | 6% | 14% | 13% | 18%
build_proto17% | 0% | 0% | 15% | 66%
extra_actions_base_proto22% | 0% | 0% | 17% | 59%
convertast48% | 25% | 0% | 11% | 14%
edit4% | 6% | 37% | 39% | 11%
warn3% | 22% | 54% | 13% | 6%
buildifier0% | 25% | 44% | 20% | 9%
api_proto0% | 29% | 0% | 16% | 53%
unused_deps0% | 20% | 32% | 32% | 15%
deps_proto0% | 26% | 0% | 14% | 59%
bzlenv0% | 0% | 36% | 34% | 28%
buildozer0% | 0% | 54% | 34% | 10%
differ0% | 0% | 46% | 21% | 31%
wspace0% | 0% | 29% | 47% | 22%
tables0% | 0% | 43% | 40% | 15%
ROOT0% | 0% | 52% | 0% | 47%
labels0% | 0% | 38% | 26% | 34%
generatetables0% | 0% | 65% | 34% | 0%
testutils0% | 0% | 45% | 36% | 17%
buildifier20% | 0% | 0% | 100% | 0%
file0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func()
in build/parse.y.go
1068 181 1
func file_build_proto_build_proto_init()
in build_proto/build.gen.pb.go
386 93 0
func()
in build/print.go
288 75 1
func()
in build/lex.go
236 86 1
func file_extra_actions_base_proto_extra_actions_base_proto_init()
in extra_actions_base_proto/extra_actions_base.gen.pb.go
172 40 0
func()
in build/lex.go
134 53 1
func convExpr()
in convertast/convert_ast.go
118 24 1
func WalkOnce()
in build/walk.go
117 44 2
func rewrite()
in edit/buildozer.go
115 30 2
func fixLabels()
in build/rewrite.go
107 39 1
func detectTypes()
in warn/types.go
105 41 1
func fixMultilinePlus()
in build/rewrite.go
96 31 1
func Buildozer()
in edit/buildozer.go
96 31 2
func Unquote()
in build/quote.go
94 29 1
func findUninitializedVariables()
in warn/warn_control_flow.go
90 32 3
func functionDocstringArgsWarning()
in warn/warn_docstring.go
84 18 1
func file_api_proto_api_proto_init()
in api_proto/api.gen.pb.go
80 15 0
func processFile()
in buildifier/buildifier.go
79 23 7
func ctxActionsWarning()
in warn/warn_bazel_api.go
73 18 1
func unsortedDictItemsWarning()
in warn/warn_cosmetic.go
72 18 1