kubernetes / test-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 5,167 units with 85,762 lines of code in units (27.5% of code).
    • 45 very long units (6,724 lines of code)
    • 221 long units (14,607 lines of code)
    • 984 medium size units (30,232 lines of code)
    • 1,382 small units (20,239 lines of code)
    • 2,535 very small units (13,960 lines of code)
7% | 17% | 35% | 23% | 16%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go7% | 18% | 35% | 23% | 15%
py12% | 8% | 38% | 21% | 19%
ts6% | 14% | 33% | 27% | 17%
js0% | 9% | 34% | 29% | 26%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
prow7% | 17% | 34% | 23% | 16%
kubetest15% | 21% | 36% | 16% | 10%
config64% | 0% | 25% | 8% | 1%
scenarios22% | 12% | 26% | 14% | 23%
testgrid17% | 19% | 26% | 20% | 15%
triage4% | 22% | 31% | 24% | 17%
robots0% | 19% | 41% | 25% | 14%
experiment0% | 9% | 40% | 33% | 16%
label_sync0% | 39% | 31% | 19% | 9%
pkg0% | 23% | 42% | 21% | 12%
gubernator0% | 8% | 37% | 27% | 27%
gopherage0% | 10% | 29% | 35% | 23%
ghproxy0% | 21% | 35% | 28% | 15%
jenkins0% | 16% | 58% | 15% | 9%
greenhouse0% | 33% | 36% | 16% | 13%
images0% | 36% | 35% | 20% | 7%
linkcheck0% | 81% | 0% | 18% | 0%
releng0% | 9% | 41% | 32% | 16%
kettle0% | 6% | 41% | 23% | 28%
boskos0% | 25% | 48% | 20% | 5%
gencred0% | 0% | 58% | 24% | 16%
gcsweb0% | 0% | 55% | 24% | 19%
maintenance0% | 0% | 54% | 33% | 11%
hack0% | 0% | 43% | 33% | 23%
logexporter0% | 0% | 30% | 63% | 5%
metrics0% | 0% | 25% | 29% | 45%
def0% | 0% | 28% | 58% | 12%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
function redraw()
in prow/cmd/deck/static/prow/prow.ts
252 62 2
func helpProvider()
in prow/plugins/bugzilla/bugzilla.go
251 27 2
func run()
in kubetest/e2e.go
241 64 2
func parseProwConfig()
in prow/config/config.go
230 77 1
def generate_presubmits_e2e()
in config/jobs/kubernetes/kops/build_jobs.py
211 6 0
def generate_misc()
in config/jobs/kubernetes/kops/build_jobs.py
207 9 0
func()
in prow/githubeventserver/githubeventserver.go
192 26 1
func main()
in prow/cmd/deck/main.go
187 35 0
func handle()
in prow/plugins/bugzilla/bugzilla.go
187 69 6
func renderSpyglass()
in prow/cmd/deck/main.go
182 36 7
func prepareGcp()
in kubetest/main.go
181 56 1
func()
in prow/plank/reconciler.go
173 45 1
func validate()
in prow/cmd/checkconfig/main.go
166 70 1
func handle()
in prow/plugins/project/project.go
159 42 4
def build_test()
in config/jobs/kubernetes/kops/build_jobs.py
155 40 11
func newKops()
in kubetest/kops.go
154 40 3
func dumpOrgConfig()
in prow/cmd/peribolos/main.go
152 25 3
func()
in testgrid/pkg/configurator/prow/prow.go
150 41 1
func()
in kubetest/aksengine.go
143 36 1
func()
in prow/cmd/sinker/main.go
143 37 1