kubernetes / kubelet
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,020 units with 13,837 lines of code in units (86.6% of code).
    • 25 very long units (4,252 lines of code)
    • 30 long units (2,360 lines of code)
    • 62 medium size units (1,947 lines of code)
    • 149 small units (2,036 lines of code)
    • 754 very small units (3,242 lines of code)
30% | 17% | 14% | 14% | 23%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go30% | 17% | 14% | 14% | 23%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
pkg/apis/deviceplugin/v1beta125% | 23% | 12% | 17% | 21%
pkg/apis/deviceplugin/v1alpha39% | 13% | 11% | 15% | 19%
pkg/apis/podresources/v134% | 17% | 15% | 12% | 20%
pkg/apis/podresources/v1alpha132% | 18% | 10% | 16% | 21%
config/v1beta161% | 0% | 0% | 2% | 35%
pkg/apis/pluginregistration/v1alpha130% | 8% | 19% | 14% | 27%
pkg/apis/pluginregistration/v1beta130% | 8% | 19% | 14% | 27%
pkg/apis/pluginregistration/v120% | 24% | 22% | 8% | 23%
pkg/apis/credentialprovider/v1alpha10% | 0% | 21% | 10% | 68%
config/v1alpha10% | 0% | 31% | 15% | 52%
pkg/apis/credentialprovider0% | 0% | 0% | 24% | 75%
pkg/apis0% | 0% | 0% | 50% | 50%
pkg/apis/credentialprovider/install0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func()
in pkg/apis/deviceplugin/v1beta1/api.pb.go
371 103 1
func()
in pkg/apis/deviceplugin/v1alpha/api.pb.go
371 103 1
func()
in config/v1beta1/zz_generated.deepcopy.go
279 59 1
func()
in pkg/apis/podresources/v1/api.pb.go
225 65 1
func()
in pkg/apis/podresources/v1/api.pb.go
193 56 1
func()
in pkg/apis/deviceplugin/v1beta1/api.pb.go
181 51 1
func()
in pkg/apis/pluginregistration/v1alpha1/api.pb.go
177 49 1
func()
in pkg/apis/pluginregistration/v1beta1/api.pb.go
177 49 1
func()
in pkg/apis/pluginregistration/v1/api.pb.go
165 44 1
func()
in pkg/apis/podresources/v1alpha1/api.pb.go
150 41 1
func()
in pkg/apis/podresources/v1/api.pb.go
149 42 1
func()
in pkg/apis/deviceplugin/v1beta1/api.pb.go
149 42 1
func()
in pkg/apis/podresources/v1/api.pb.go
147 41 1
func()
in pkg/apis/deviceplugin/v1beta1/api.pb.go
145 40 1
func()
in pkg/apis/deviceplugin/v1alpha/api.pb.go
145 40 1
func()
in pkg/apis/deviceplugin/v1alpha/api.pb.go
145 40 1
func()
in pkg/apis/podresources/v1/api.pb.go
136 39 1
func()
in pkg/apis/deviceplugin/v1beta1/api.pb.go
133 37 1
func()
in pkg/apis/deviceplugin/v1alpha/api.pb.go
133 37 1
func()
in pkg/apis/deviceplugin/v1beta1/api.pb.go
132 37 1