golang / go
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 33,498 units with 643,739 lines of code in units (65.3% of code).
    • 279 very complex units (117,479 lines of code)
    • 613 complex units (74,530 lines of code)
    • 2,242 medium complex units (124,655 lines of code)
    • 3,544 simple units (100,044 lines of code)
    • 26,820 very simple units (227,031 lines of code)
18% | 11% | 19% | 15% | 35%
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
go18% | 11% | 19% | 15% | 35%
js0% | 67% | 0% | 4% | 27%
pl0% | 0% | 0% | 35% | 64%
py0% | 0% | 0% | 0% | 100%
c0% | 0% | 0% | 0% | 100%
h0% | 0% | 0% | 0% | 100%
cc0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
src/cmd29% | 14% | 19% | 13% | 22%
src/go13% | 13% | 25% | 18% | 28%
src/runtime3% | 6% | 21% | 19% | 48%
src/encoding8% | 13% | 21% | 19% | 36%
src/image11% | 7% | 24% | 16% | 40%
src/internal5% | 7% | 22% | 23% | 40%
src/debug12% | 18% | 24% | 16% | 28%
src/crypto2% | 6% | 16% | 16% | 57%
src/time17% | 7% | 16% | 24% | 34%
src/reflect11% | 8% | 19% | 22% | 38%
src/syscall<1% | 2% | 1% | 4% | 91%
src/database9% | 0% | 14% | 24% | 51%
src/regexp4% | 22% | 27% | 14% | 30%
src/net<1% | 8% | 20% | 24% | 45%
src/fmt7% | 22% | 15% | 19% | 35%
src/archive5% | 4% | 34% | 16% | 39%
src/testing3% | 12% | 27% | 18% | 38%
src/math0% | 7% | 28% | 21% | 42%
src/strconv0% | 20% | 45% | 17% | 16%
src/compress0% | 15% | 26% | 23% | 35%
misc/wasm0% | 74% | 0% | 0% | 25%
src/path0% | 24% | 23% | 24% | 27%
src/text0% | 5% | 25% | 16% | 52%
src/html0% | 3% | 14% | 14% | 67%
src/os0% | 2% | 24% | 21% | 50%
src/bufio0% | 11% | 6% | 44% | 37%
src/mime0% | 0% | 32% | 35% | 31%
src/strings0% | 0% | 25% | 33% | 40%
src/bytes0% | 0% | 23% | 24% | 51%
src/sort0% | 0% | 46% | 12% | 40%
src/unicode0% | 0% | 41% | 28% | 29%
misc/android0% | 0% | 62% | 23% | 13%
src/sync0% | 0% | 14% | 40% | 44%
src/index0% | 0% | 6% | 73% | 19%
src/flag0% | 0% | 17% | 8% | 74%
misc/ios0% | 0% | 11% | 55% | 33%
src/plugin0% | 0% | 81% | 0% | 18%
src/log0% | 0% | 12% | 6% | 81%
misc/linkcheck0% | 0% | 39% | 0% | 60%
src/io0% | 0% | 6% | 28% | 65%
src/hash0% | 0% | 0% | 10% | 89%
src/context0% | 0% | 0% | 40% | 59%
src/errors0% | 0% | 0% | 73% | 26%
src/embed0% | 0% | 0% | 23% | 76%
src/container0% | 0% | 0% | 12% | 87%
misc/chrome0% | 0% | 0% | 53% | 46%
misc/cgo0% | 0% | 0% | 0% | 100%
src/expvar0% | 0% | 0% | 0% | 100%
src/builtin0% | 0% | 0% | 0% | 100%
misc/swig0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
func rewriteBlockARM()
in src/cmd/compile/internal/ssa/rewriteARM.go
4892 975 1
func rewriteValueARM64_OpARM64OR()
in src/cmd/compile/internal/ssa/rewriteARM64.go
1947 949 1
func rewriteValueARM64_OpARM64ORshiftLL()
in src/cmd/compile/internal/ssa/rewriteARM64.go
1589 728 1
func rewriteValuePPC64_OpPPC64OR()
in src/cmd/compile/internal/ssa/rewritePPC64.go
1458 669 1
func rewriteValueARM64_OpARM64MOVBstore()
in src/cmd/compile/internal/ssa/rewriteARM64.go
1399 622 1
func()
in src/cmd/internal/obj/arm64/asm7.go
2042 580 1
func rewriteValueAMD64_OpAMD64ORQ()
in src/cmd/compile/internal/ssa/rewriteAMD64.go
1398 529 1
func rewriteValueAMD64()
in src/cmd/compile/internal/ssa/rewriteAMD64.go
1166 528 1
func vop()
in src/cmd/internal/obj/s390x/vector.go
1010 503 1
func rewriteBlockARM64()
in src/cmd/compile/internal/ssa/rewriteARM64.go
2489 499 1
func rewriteValueARM64()
in src/cmd/compile/internal/ssa/rewriteARM64.go
1125 492 1
func rewriteValueAMD64_OpAMD64ORL()
in src/cmd/compile/internal/ssa/rewriteAMD64.go
1276 487 1
func()
in src/cmd/internal/obj/s390x/asmz.go
1473 479 1
func()
in src/cmd/internal/obj/ppc64/asm9.go
924 460 1
func rewriteValueAMD64_OpAMD64MOVBstore()
in src/cmd/compile/internal/ssa/rewriteAMD64.go
1075 441 1
func rewriteBlockS390X()
in src/cmd/compile/internal/ssa/rewriteS390X.go
1583 438 1
func rewriteValueARM()
in src/cmd/compile/internal/ssa/rewriteARM.go
891 404 1
func rewriteValueS390X()
in src/cmd/compile/internal/ssa/rewriteS390X.go
873 381 1
func rewriteValuePPC64()
in src/cmd/compile/internal/ssa/rewritePPC64.go
827 363 1
func()
in src/cmd/internal/obj/ppc64/asm9.go
1020 331 1