kubernetes / api
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 14,170 units with 246,598 lines of code in units (88.3% of code).
    • 731 very long units (128,823 lines of code)
    • 263 long units (19,374 lines of code)
    • 935 medium size units (28,764 lines of code)
    • 1,678 small units (24,134 lines of code)
    • 10,563 very small units (45,503 lines of code)
52% | 7% | 11% | 9% | 18%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go52% | 7% | 11% | 9% | 18%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
core58% | 7% | 9% | 8% | 15%
autoscaling53% | 5% | 12% | 9% | 18%
apps52% | 5% | 13% | 10% | 18%
extensions50% | 7% | 11% | 10% | 20%
flowcontrol41% | 11% | 11% | 11% | 23%
storage48% | 9% | 13% | 9% | 19%
rbac45% | 6% | 12% | 15% | 20%
networking43% | 9% | 12% | 12% | 22%
authorization49% | 7% | 14% | 8% | 20%
admissionregistration54% | 7% | 12% | 9% | 15%
policy51% | 10% | 8% | 10% | 19%
batch51% | 7% | 13% | 9% | 17%
admission64% | 8% | 12% | 3% | 10%
node49% | 5% | 14% | 12% | 18%
certificates49% | 11% | 12% | 9% | 17%
authentication47% | 10% | 11% | 9% | 20%
discovery42% | 14% | 16% | 7% | 19%
events63% | 5% | 8% | 7% | 15%
scheduling43% | 11% | 10% | 14% | 21%
coordination43% | 8% | 16% | 9% | 21%
apiserverinternal46% | 4% | 17% | 8% | 23%
imagepolicy45% | 11% | 15% | 7% | 20%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func()
in core/v1/generated.pb.go
1313 377 1
func()
in core/v1/generated.pb.go
1093 332 1
func()
in core/v1/generated.pb.go
841 255 1
func()
in policy/v1beta1/generated.pb.go
755 220 1
func()
in extensions/v1beta1/generated.pb.go
755 220 1
func()
in core/v1/generated.pb.go
748 218 1
func()
in core/v1/generated.pb.go
748 218 1
func()
in core/v1/generated.pb.go
726 202 1
func()
in core/v1/generated.pb.go
725 204 1
func()
in core/v1/generated.pb.go
609 174 1
func()
in admission/v1beta1/generated.pb.go
532 155 1
func()
in admission/v1/generated.pb.go
532 155 1
func()
in core/v1/generated.pb.go
530 155 1
func()
in events/v1beta1/generated.pb.go
530 155 1
func()
in events/v1/generated.pb.go
530 155 1
func()
in core/v1/generated.pb.go
479 137 1
func()
in core/v1/generated.pb.go
444 126 1
func()
in core/v1/generated.pb.go
438 122 1
func()
in core/v1/generated.pb.go
436 125 1
func()
in core/v1/generated.pb.go
414 59 1