kubernetes / legacy-cloud-providers
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 2,109 units with 33,583 lines of code in units (87.9% of code).
    • 25 very long units (4,006 lines of code)
    • 70 long units (4,704 lines of code)
    • 398 medium size units (11,513 lines of code)
    • 440 small units (6,667 lines of code)
    • 1,176 very small units (6,693 lines of code)
11% | 14% | 34% | 19% | 19%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go11% | 14% | 34% | 19% | 19%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
azure15% | 24% | 30% | 19% | 9%
aws15% | 20% | 32% | 18% | 14%
vsphere24% | 18% | 29% | 16% | 10%
openstack22% | 8% | 33% | 23% | 12%
gce7% | 8% | 29% | 23% | 31%
vsphere/vclib6% | 9% | 31% | 32% | 18%
azure/clients0% | 1% | 51% | 13% | 34%
azure/auth0% | 34% | 28% | 26% | 10%
azure/metrics0% | 0% | 70% | 0% | 29%
gce/gcpcredential0% | 0% | 37% | 40% | 22%
azure/retry0% | 0% | 15% | 47% | 37%
azure/mockvmsets0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func()
in azure/azure_loadbalancer.go
357 84 1
func()
in aws/aws.go
326 70 1
func()
in openstack/openstack_loadbalancer.go
293 80 1
func()
in aws/aws_loadbalancer.go
215 50 1
func()
in aws/aws_loadbalancer.go
206 40 1
func()
in vsphere/vsphere.go
197 43 1
func()
in azure/azure_loadbalancer.go
182 50 1
func()
in gce/gce_loadbalancer_external.go
159 46 1
func()
in azure/azure.go
147 38 1
func()
in vsphere/nodemanager.go
147 24 1
func()
in gce/gce_loadbalancer_internal.go
146 36 1
142 31 1
func()
in aws/aws.go
137 29 1
func()
in openstack/openstack_loadbalancer.go
135 27 1
func()
in azure/azure_loadbalancer.go
122 28 1
func()
in openstack/openstack_loadbalancer.go
115 31 1
func()
in azure/azure_vmss.go
115 31 1
func()
in azure/azure_loadbalancer.go
115 24 1
func()
in vsphere/vsphere.go
114 25 1
112 18 1