kubernetes / repo-infra
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 57 units with 1,181 lines of code in units (38.3% of code).
    • 0 very long units (0 lines of code)
    • 6 long units (420 lines of code)
    • 13 medium size units (445 lines of code)
    • 14 small units (185 lines of code)
    • 24 very small units (131 lines of code)
0% | 35% | 37% | 15% | 11%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go0% | 42% | 32% | 16% | 8%
py0% | 0% | 64% | 12% | 23%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
tools/build_tar0% | 67% | 13% | 6% | 11%
cmd/kazel0% | 21% | 50% | 22% | 5%
hack0% | 0% | 59% | 15% | 24%
defs0% | 0% | 80% | 0% | 20%
defs/testgen0% | 0% | 0% | 100% | 0%
defs/testpkg0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func newFileMeta()
in tools/build_tar/buildtar.go
99 21 7
func main()
in tools/build_tar/buildtar.go
86 16 0
func()
in tools/build_tar/buildtar.go
67 15 1
func()
in tools/build_tar/buildtar.go
59 17 1
func()
in cmd/kazel/sourcerer.go
55 12 1
func ReconcileRules()
in cmd/kazel/kazel.go
54 15 4
func()
in cmd/kazel/generator.go
45 14 1
def file_passes()
in hack/verify_boilerplate.py
42 20 3
func()
in cmd/kazel/generator.go
38 8 1
func main()
in cmd/kazel/kazel.go
38 12 0
func newTarFile()
in tools/build_tar/buildtar.go
38 5 4
def main()
in defs/gcs_uploader.py
36 9 1
func newVendorer()
in cmd/kazel/kazel.go
36 7 3
func asExpr()
in cmd/kazel/kazel.go
34 9 1
func writeFile()
in cmd/kazel/kazel.go
34 8 5
func Diff()
in cmd/kazel/diff.go
29 5 2
def get_args()
in hack/verify_boilerplate.py
28 1 0
func()
in tools/build_tar/buildtar.go
26 7 1
def get_files()
in hack/verify_boilerplate.py
21 11 1
func()
in cmd/kazel/kazel.go
18 5 1