kubernetes / apimachinery
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 2,876 units with 36,392 lines of code in units (85.6% of code).
    • 45 very long units (8,297 lines of code)
    • 57 long units (4,055 lines of code)
    • 246 medium size units (7,466 lines of code)
    • 442 small units (6,277 lines of code)
    • 2,086 very small units (10,297 lines of code)
22% | 11% | 20% | 17% | 28%
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% | 20% | 17% | 28%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
pkg/apis42% | 8% | 11% | 12% | 24%
pkg/runtime5% | 13% | 27% | 19% | 33%
pkg/util3% | 12% | 31% | 22% | 29%
pkg/api0% | 20% | 27% | 21% | 30%
pkg/labels0% | 0% | 46% | 18% | 34%
pkg/conversion0% | 0% | 31% | 43% | 25%
pkg/watch0% | 0% | 13% | 32% | 54%
pkg/version0% | 0% | 94% | 0% | 5%
pkg/fields0% | 0% | 0% | 25% | 74%
pkg/types0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func()
in pkg/apis/meta/v1/generated.pb.go
735 208 1
func()
in pkg/apis/testapigroup/v1/generated.pb.go
500 141 1
func()
in pkg/apis/meta/v1/generated.pb.go
361 102 1
func()
in pkg/apis/meta/v1/generated.pb.go
288 82 1
func()
in pkg/apis/meta/v1/generated.pb.go
281 80 1
func()
in pkg/apis/testapigroup/v1/generated.pb.go
279 79 1
func()
in pkg/apis/testapigroup/v1/generated.pb.go
243 69 1
func RegisterConversions()
in pkg/apis/meta/v1/zz_generated.conversion.go
238 48 1
func()
in pkg/apis/meta/v1/generated.pb.go
233 67 1
func()
in pkg/apis/meta/v1/generated.pb.go
230 65 1
func()
in pkg/apis/meta/v1/generated.pb.go
229 65 1
func()
in pkg/apis/meta/v1/generated.pb.go
219 61 1
func()
in pkg/apis/meta/v1/generated.pb.go
210 58 1
func()
in pkg/apis/meta/v1/generated.pb.go
191 54 1
func()
in pkg/apis/meta/v1/generated.pb.go
182 52 1
func()
in pkg/runtime/generated.pb.go
180 51 1
func()
in pkg/apis/meta/v1/generated.pb.go
166 46 1
func()
in pkg/apis/meta/v1/generated.pb.go
165 46 1
func()
in pkg/apis/meta/v1/generated.pb.go
159 19 1
func()
in pkg/apis/testapigroup/v1/generated.pb.go
148 43 1