awslabs / kubernetes-iteration-toolkit
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 350 units with 4,858 lines of code in units (34.0% of code).
    • 3 very long units (527 lines of code)
    • 9 long units (687 lines of code)
    • 46 medium size units (1,294 lines of code)
    • 89 small units (1,313 lines of code)
    • 203 very small units (1,037 lines of code)
10% | 14% | 26% | 27% | 21%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go11% | 10% | 26% | 28% | 22%
ts0% | 70% | 23% | 5% | 0%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
operator/pkg/controllers26% | 15% | 17% | 23% | 16%
substrate/pkg/controller0% | 17% | 49% | 28% | 4%
testbed/addons/karpenter0% | 100% | 0% | 0% | 0%
testbed/addons/kit0% | 100% | 0% | 0% | 0%
testbed0% | 100% | 0% | 0% | 0%
operator/pkg/awsprovider0% | 0% | 38% | 39% | 21%
substrate/pkg/apis0% | 0% | 38% | 8% | 52%
operator/pkg/utils0% | 0% | 14% | 47% | 38%
testbed/addons/flux0% | 0% | 100% | 0% | 0%
operator/pkg/pki0% | 0% | 23% | 63% | 13%
operator/cmd/controller0% | 0% | 100% | 0% | 0%
testbed/addons/awslb0% | 0% | 100% | 0% | 0%
substrate/cmd0% | 0% | 38% | 19% | 42%
operator/cmd/webhook0% | 0% | 52% | 0% | 47%
operator/pkg/apis0% | 0% | 0% | 19% | 80%
operator/pkg/kubeprovider0% | 0% | 0% | 89% | 10%
testbed/addons0% | 0% | 0% | 100% | 0%
operator/pkg/errors0% | 0% | 0% | 0% | 100%
substrate/pkg/utils0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func apiServerPodSpecFor()
in operator/pkg/controllers/master/kubeapiserver.go
255 1 1
func podSpecFor()
in operator/pkg/controllers/etcd/pod.go
138 1 1
func kcmPodSpecFor()
in operator/pkg/controllers/master/kubecontrollermanager.go
134 1 1
func()
in substrate/pkg/controller/substrate/cluster/launchtemplate.go
99 13 1
func()
in operator/pkg/controllers/master/authenticatorconfig.go
86 1 1
constructor()
in testbed/addons/karpenter/construct.ts
83 1 3
func kubeProxyPodSpecFor()
in operator/pkg/controllers/addons/kubeproxy.go
82 1 1
func()
in operator/pkg/controllers/addons/coredns.go
80 1 1
constructor()
in testbed/addons/kit/construct.ts
70 1 3
constructor()
in testbed/stack.ts
67 3 3
func()
in substrate/pkg/controller/substrate/cluster/instance.go
61 18 1
func schedulerPodSpecFor()
in operator/pkg/controllers/master/kubescheduler.go
59 1 1
func()
in operator/pkg/awsprovider/launchtemplate/reconciler.go
48 6 1
constructor()
in testbed/addons/flux/construct.ts
44 1 3
func defaultClusterConfig()
in substrate/pkg/controller/substrate/cluster/config.go
44 3 1
func()
in substrate/pkg/controller/substrate/cluster/instanceprofile.go
40 12 1
func()
in substrate/pkg/controller/substrate/cluster/instanceprofile.go
38 10 1
func()
in operator/pkg/controllers/addons/coredns.go
37 1 1
func()
in substrate/pkg/controller/substrate/infrastructure/internetgateway.go
35 9 1
func()
in operator/pkg/awsprovider/instances/reconciler.go
35 4 1