golang / tools
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 6,247 units with 100,126 lines of code in units (74.8% of code).
    • 24 very complex units (4,859 lines of code)
    • 101 complex units (11,369 lines of code)
    • 454 medium complex units (25,065 lines of code)
    • 833 simple units (22,881 lines of code)
    • 4,835 very simple units (35,952 lines of code)
4% | 11% | 25% | 22% | 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
go4% | 11% | 25% | 22% | 35%
ts7% | 13% | 25% | 17% | 35%
js0% | 0% | 2% | 23% | 74%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
go7% | 11% | 25% | 21% | 32%
internal4% | 9% | 23% | 24% | 38%
cmd2% | 19% | 25% | 20% | 31%
refactor6% | 20% | 36% | 19% | 17%
present15% | 6% | 34% | 16% | 27%
godoc0% | 5% | 19% | 19% | 55%
gopls0% | 0% | 20% | 45% | 33%
container0% | 0% | 29% | 30% | 39%
blog0% | 0% | 45% | 35% | 19%
playground0% | 0% | 28% | 30% | 41%
cover0% | 0% | 59% | 18% | 22%
copyright0% | 0% | 0% | 82% | 17%
benchmark0% | 0% | 0% | 32% | 68%
txtar0% | 0% | 0% | 0% | 100%
imports0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
func binop()
in go/ssa/interp/ops.go
444 212 4
func serverDispatch()
in internal/lsp/protocol/tsserver.go
503 145 4
func run()
in go/analysis/passes/asmdecl/asmdecl.go
239 83 1
func()
in internal/lsp/source/options.go
214 74 1
func setup()
in cmd/goyacc/yacc.go
289 73 0
func conv()
in go/ssa/interp/ops.go
175 72 3
func childrenOf()
in go/ast/astutil/enclosing.go
201 69 1
func NodeDescription()
in go/ast/astutil/enclosing.go
141 68 1
func expectedCandidate()
in internal/lsp/source/completion/completion.go
168 67 2
func()
in internal/lsp/semantic.go
145 66 1
func extractFunctionMethod()
in internal/lsp/source/extract.go
256 66 7
func()
in refactor/satisfy/find.go
183 65 1
func()
in go/ast/astutil/rewrite.go
189 65 1
func asmCheckVar()
in go/analysis/passes/asmdecl/asmdecl.go
166 62 2
func visitInstr()
in go/ssa/interp/interp.go
191 60 2
func gettok()
in cmd/goyacc/yacc.go
152 58 0
func typeOf()
in go/ast/inspector/typeof.go
120 58 1
func parseSections()
in present/parse.go
172 58 5
function goUnionType()
in internal/lsp/protocol/typescript/code.ts
97 57 2
func()
in go/ssa/sanity.go
100 55 1