kubernetes / component-base
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 511 units with 4,097 lines of code in units (74.0% of code).
    • 0 very long units (0 lines of code)
    • 2 long units (127 lines of code)
    • 26 medium size units (721 lines of code)
    • 85 small units (1,215 lines of code)
    • 398 very small units (2,034 lines of code)
0% | 3% | 17% | 29% | 49%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go0% | 3% | 17% | 29% | 49%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
config0% | 8% | 19% | 19% | 53%
logs0% | 9% | 30% | 25% | 34%
cli0% | 0% | 30% | 23% | 45%
metrics0% | 0% | 8% | 35% | 56%
featuregate0% | 0% | 29% | 41% | 28%
traces0% | 0% | 0% | 90% | 9%
version0% | 0% | 0% | 41% | 58%
configz0% | 0% | 0% | 34% | 65%
term0% | 0% | 0% | 100% | 0%
codec0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func RegisterConversions()
in config/v1alpha1/zz_generated.conversion.go
73 15 1
func datatypes()
in logs/datapol/datapol.go
54 20 1
func configureAndRun()
in logs/kube-log-runner/kube-log-runner.go
42 10 0
func run()
in cli/run.go
37 4 1
func()
in featuregate/feature_gate.go
35 10 1
func GetRoundtripTestCases()
in config/testing/roundtrip.go
35 9 3
34 13 2
func matchOutputFile()
in config/testing/helpers.go
34 10 3
func()
in cli/flag/map_string_string.go
32 9 1
func NewJSONLogger()
in logs/json/json.go
32 3 3
func AddFlags()
in logs/logs.go
30 9 2
func BindLeaderElectionFlags()
in config/options/leaderelectionconfig.go
29 1 2
func GetHistogramVecFromGatherer()
in metrics/testutil/metrics.go
28 9 3
func ValidateLeaderElectionConfiguration()
in config/validation/validation.go
28 9 2
func AddGoFlags()
in logs/logs.go
27 8 2
func()
in cli/flag/map_string_bool.go
26 8 1
func PrintSections()
in cli/flag/sectioned.go
25 5 3
func()
in cli/flag/namedcertkey_flag.go
25 5 1
func()
in metrics/metric.go
24 6 1
func bucketQuantile()
in metrics/testutil/metrics.go
23 7 2