kubernetes / kubectl
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,857 units with 32,236 lines of code in units (50.1% of code).
    • 17 very long units (2,349 lines of code)
    • 82 long units (5,486 lines of code)
    • 436 medium size units (13,209 lines of code)
    • 433 small units (6,345 lines of code)
    • 889 very small units (4,847 lines of code)
7% | 17% | 40% | 19% | 15%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go7% | 17% | 40% | 19% | 15%
py0% | 0% | 70% | 0% | 29%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
pkg/cmd9% | 18% | 43% | 16% | 11%
pkg/generate22% | 14% | 16% | 37% | 8%
pkg/describe2% | 20% | 43% | 22% | 10%
pkg/polymorphichelpers7% | 26% | 34% | 22% | 8%
pkg/drain0% | 17% | 28% | 34% | 18%
pkg/util0% | 2% | 32% | 32% | 31%
pkg/apply0% | 4% | 19% | 24% | 51%
pkg/explain0% | 0% | 32% | 26% | 41%
pkg/proxy0% | 0% | 31% | 30% | 37%
pkg/metricsutil0% | 0% | 23% | 35% | 40%
pkg/scale0% | 0% | 37% | 46% | 15%
pkg/rawhttp0% | 0% | 76% | 0% | 23%
pkg/validation0% | 0% | 60% | 0% | 39%
pkg/apps0% | 0% | 74% | 0% | 25%
pkg/scheme0% | 0% | 88% | 0% | 12%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func()
in pkg/cmd/set/set_env.go
232 58 1
func()
in pkg/cmd/util/editor/editoptions.go
187 43 1
func testDynamicResources()
in pkg/cmd/testing/fake.go
183 1 0
func()
in pkg/cmd/apply/apply.go
147 38 1
func()
in pkg/cmd/run/run.go
144 40 1
func NewKubectlCommand()
in pkg/cmd/cmd.go
142 7 1
func generateService()
in pkg/generate/versioned/service.go
140 44 1
func()
in pkg/cmd/expose/expose.go
136 37 1
func()
in pkg/cmd/label/label.go
130 33 1
func()
in pkg/cmd/config/create_authinfo.go
123 38 1
func()
in pkg/cmd/clusterinfo/clusterinfo_dump.go
122 33 1
119 39 3
func isLess()
in pkg/cmd/get/sorter.go
114 49 2
func()
in pkg/cmd/get/get.go
113 30 1
func()
in pkg/cmd/annotate/annotate.go
108 27 1
func logsForObjectWithClient()
in pkg/polymorphichelpers/logsforobject.go
108 33 5
func()
in pkg/cmd/patch/patch.go
101 23 1
func SelectorsForObject()
in pkg/polymorphichelpers/helpers.go
100 33 1
func()
in pkg/cmd/replace/replace.go
97 20 1
func()
in pkg/cmd/util/editor/editoptions.go
96 21 1