kubernetes / kube-openapi
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 855 units with 9,308 lines of code in units (81.8% of code).
    • 3 very long units (402 lines of code)
    • 13 long units (853 lines of code)
    • 83 medium size units (2,601 lines of code)
    • 198 small units (2,733 lines of code)
    • 558 very small units (2,719 lines of code)
4% | 9% | 27% | 29% | 29%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go4% | 9% | 27% | 29% | 29%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
pkg/handler45% | 0% | 21% | 13% | 19%
pkg/schemamutation32% | 15% | 50% | 0% | <1%
pkg/validation2% | 7% | 18% | 35% | 35%
pkg/generators0% | 11% | 37% | 26% | 24%
pkg/builder0% | 32% | 37% | 14% | 15%
pkg/aggregator0% | 21% | 51% | 16% | 10%
pkg/builder30% | 16% | 58% | 11% | 14%
pkg/util0% | 6% | 26% | 21% | 45%
pkg/schemaconv0% | 0% | 70% | 16% | 12%
pkg/handler30% | 0% | 29% | 44% | 25%
pkg/spec30% | 0% | 6% | 73% | 20%
cmd/openapi2smd0% | 0% | 100% | 0% | 0%
cmd/openapi-gen0% | 0% | 0% | 74% | 25%
pkg/common0% | 0% | 0% | 11% | 88%
pkg/internal0% | 0% | 0% | 45% | 54%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func PruneDefaultsSchema()
in pkg/handler/default_pruning.go
151 43 1
func()
in pkg/schemamutation/walker.go
137 39 1
func()
in pkg/validation/validate/schema_props.go
114 37 1
func mergeSpecs()
in pkg/aggregator/aggregator.go
82 26 4
func()
in pkg/generators/openapi.go
82 17 1
func()
in pkg/validation/strfmt/format.go
75 30 1
func()
in pkg/validation/validate/type.go
74 33 1
func()
in pkg/builder/openapi.go
71 20 1
func()
in pkg/validation/validate/object_validator.go
69 33 1
func()
in pkg/schemamutation/walker.go
63 17 1
func()
in pkg/builder3/openapi.go
60 18 1
func()
in pkg/generators/openapi.go
57 16 1
func()
in pkg/builder/openapi.go
57 16 1
func()
in pkg/validation/validate/slice_validator.go
55 22 1
func itemFactory()
in pkg/util/proto/validation/types.go
54 8 2
func()
in pkg/validation/validate/schema.go
54 13 1
func mergedGVKs()
in pkg/aggregator/aggregator.go
49 11 2
func()
in pkg/aggregator/walker.go
48 17 1
func IsValueValidAgainstRange()
in pkg/validation/validate/values.go
48 14 5
func()
in pkg/builder3/openapi.go
48 13 1