kubernetes / client-go
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 10,729 units with 80,544 lines of code in units (69.5% of code).
    • 7 very long units (2,145 lines of code)
    • 30 long units (1,963 lines of code)
    • 450 medium size units (11,727 lines of code)
    • 1,443 small units (20,030 lines of code)
    • 8,799 very small units (44,679 lines of code)
2% | 2% | 14% | 24% | 55%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go2% | 2% | 14% | 24% | 55%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
applyconfigurations4% | 0% | 0% | 4% | 91%
tools4% | 12% | 28% | 27% | 26%
informers4% | 0% | 49% | 1% | 44%
kubernetes<1% | 0% | 13% | 50% | 35%
util3% | 13% | 34% | 19% | 28%
transport12% | 6% | 20% | 35% | 25%
rest0% | 21% | 23% | 28% | 26%
plugin0% | 17% | 36% | 29% | 16%
testing0% | 10% | 16% | 22% | 50%
restmapper0% | 21% | 37% | 25% | 14%
dynamic0% | 0% | 55% | 22% | 22%
listers0% | 0% | 13% | 0% | 86%
metadata0% | 0% | 54% | 23% | 22%
discovery0% | 0% | 43% | 26% | 29%
scale0% | 0% | 32% | 19% | 48%
pkg0% | 0% | 15% | 25% | 58%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func ForKind()
in applyconfigurations/utils.go
1237 617 1
func()
in informers/generic.go
201 99 1
func NewForConfigAndClient()
in kubernetes/clientset.go
196 50 2
func ModifyConfig()
in tools/clientcmd/config.go
151 49 3
func RegisterConversions()
in tools/clientcmd/api/v1/zz_generated.conversion.go
123 25 1
func WaitForCertificate()
in util/certificate/csr/csr.go
122 26 4
func()
in transport/round_trippers.go
115 16 1
func()
in tools/watch/retrywatcher.go
97 21 1
func ObjectReaction()
in testing/fixture.go
95 26 1
87 16 4
func()
in plugin/pkg/client/auth/exec/exec.go
84 25 1
func()
in tools/remotecommand/v1.go
83 24 1
func NewDiscoveryRESTMapper()
in restmapper/discovery.go
80 12 1
func()
in rest/request.go
77 18 1
func()
in util/jsonpath/parser.go
74 19 1
func()
in rest/request.go
70 20 1
func()
in rest/request.go
70 12 1
func validateAuthInfo()
in tools/clientcmd/validation.go
68 30 2
func()
in rest/request.go
68 18 1
func()
in util/jsonpath/jsonpath.go
65 21 1