kubernetes / apiserver
Conditional Complexity

The distribution of complexity of units (measured with McCabe index).

Intro
  • Conditional complexity (also called cyclomatic complexity) is a term used to measure the complexity of software. The term refers to the number of possible paths through a program function. A higher value ofter means higher maintenance and testing costs (infosecinstitute.com).
  • Conditional complexity is calculated by counting all conditions in the program that can affect the execution path (e.g. if statement, loops, switches, and/or operators, try and catch blocks...).
  • Conditional complexity is measured at the unit level (methods, functions...).
  • Units are classified in four categories based on the measured McCabe index: 1-5 (simple units), 6-10 (medium complex units), 11-25 (complex units), 26+ (very complex units).
Learn more...
Conditional Complexity Overall
  • There are 3,603 units with 50,463 lines of code in units (71.2% of code).
    • 14 very complex units (5,946 lines of code)
    • 28 complex units (3,611 lines of code)
    • 119 medium complex units (7,415 lines of code)
    • 278 simple units (8,046 lines of code)
    • 3,164 very simple units (25,445 lines of code)
11% | 7% | 14% | 15% | 50%
Legend:
51+
26-50
11-25
6-10
1-5
Alternative Visuals
Conditional Complexity per Extension
51+
26-50
11-25
6-10
1-5
go11% | 7% | 14% | 15% | 50%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
pkg/apis30% | 12% | 12% | 6% | 37%
pkg/endpoints10% | 7% | 20% | 20% | 40%
pkg/storage3% | 0% | 9% | 18% | 67%
pkg/admission0% | 8% | 12% | 9% | 69%
pkg/registry0% | 12% | 25% | 21% | 41%
pkg/server0% | 2% | 14% | 27% | 56%
pkg/util0% | 0% | 10% | 21% | 67%
plugin/pkg0% | 0% | 28% | 15% | 55%
pkg/audit0% | 0% | 22% | 19% | 57%
pkg/authentication0% | 0% | 8% | 32% | 58%
pkg/quota0% | 0% | 9% | 12% | 78%
pkg/storageversion0% | 0% | 0% | 54% | 45%
pkg/authorization0% | 0% | 0% | 37% | 62%
pkg/tracing0% | 0% | 0% | 35% | 64%
pkg/warning0% | 0% | 0% | 0% | 100%
pkg/features0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex 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/apis/audit/v1/generated.pb.go
679 196 1
func()
in pkg/apis/example/v1/generated.pb.go
500 141 1
func()
in pkg/endpoints/installer.go
714 133 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()
in pkg/apis/example/v1/generated.pb.go
243 69 1
func()
in pkg/storage/etcd3/store.go
174 52 1
func()
in pkg/apis/audit/v1alpha1/generated.pb.go
168 48 1
func()
in pkg/apis/audit/v1beta1/generated.pb.go
168 48 1
func()
in pkg/apis/audit/v1/generated.pb.go
168 48 1
func codeToString()
in pkg/endpoints/metrics/metrics.go
94 45 1
func()
in pkg/apis/example/v1/generated.pb.go
148 43 1
func()
in pkg/apis/audit/v1alpha1/generated.pb.go
145 40 1