kubernetes / apiserver
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 3,603 units with 50,463 lines of code in units (71.2% of code).
    • 51 very long units (11,340 lines of code)
    • 89 long units (6,032 lines of code)
    • 375 medium size units (11,325 lines of code)
    • 673 small units (9,581 lines of code)
    • 2,415 very small units (12,185 lines of code)
22% | 11% | 22% | 18% | 24%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go22% | 11% | 22% | 18% | 24%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
pkg/apis46% | 9% | 11% | 9% | 21%
pkg/endpoints20% | 14% | 25% | 20% | 19%
pkg/admission24% | 15% | 12% | 19% | 27%
pkg/server4% | 14% | 32% | 25% | 23%
pkg/storage6% | 7% | 23% | 27% | 34%
pkg/registry8% | 15% | 38% | 24% | 12%
pkg/util0% | 13% | 34% | 24% | 28%
plugin/pkg0% | 25% | 27% | 18% | 28%
pkg/audit0% | 7% | 33% | 23% | 36%
pkg/authentication0% | 0% | 37% | 35% | 26%
pkg/storageversion0% | 0% | 47% | 18% | 33%
pkg/quota0% | 0% | 19% | 37% | 42%
pkg/authorization0% | 0% | 37% | 19% | 42%
pkg/tracing0% | 0% | 35% | 60% | 4%
pkg/warning0% | 0% | 0% | 0% | 100%
pkg/features0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func()
in pkg/apis/audit/v1alpha1/generated.pb.go
745 216 1
func()
in pkg/apis/audit/v1beta1/generated.pb.go
745 216 1
func()
in pkg/endpoints/installer.go
714 133 1
func()
in pkg/apis/audit/v1/generated.pb.go
679 196 1
func()
in pkg/apis/example/v1/generated.pb.go
500 141 1
func NewNonMutatingTestCases()
in pkg/admission/plugin/webhook/testing/testcase.go
379 1 1
func()
in pkg/apis/audit/v1alpha1/generated.pb.go
328 92 1
func()
in pkg/apis/audit/v1beta1/generated.pb.go
328 92 1
func()
in pkg/apis/audit/v1/generated.pb.go
328 92 1
func()
in pkg/apis/audit/v1beta1/generated.pb.go
305 85 1
func()
in pkg/apis/audit/v1/generated.pb.go
305 85 1
func()
in pkg/apis/example/v1/generated.pb.go
279 79 1
func()
in pkg/apis/audit/v1alpha1/generated.pb.go
273 76 1
func NewMutatingTestCases()
in pkg/admission/plugin/webhook/testing/testcase.go
260 1 2
func()
in pkg/apis/example/v1/generated.pb.go
243 69 1
func()
in pkg/apis/audit/v1alpha1/generated.pb.go
186 21 1
func()
in pkg/apis/audit/v1beta1/generated.pb.go
186 21 1
func()
in pkg/storage/etcd3/store.go
174 52 1
func UpdateResource()
in pkg/endpoints/handlers/update.go
172 31 3
func()
in pkg/apis/audit/v1alpha1/generated.pb.go
168 48 1