golang / pkgsite
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 1,633 units with 28,186 lines of code in units (63.0% of code).
    • 0 very complex units (0 lines of code)
    • 7 complex units (739 lines of code)
    • 101 medium complex units (5,979 lines of code)
    • 276 simple units (7,859 lines of code)
    • 1,249 very simple units (13,609 lines of code)
0% | 2% | 21% | 27% | 48%
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
go0% | 2% | 21% | 28% | 47%
ts0% | 0% | 21% | 18% | 60%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
internal/godoc0% | 5% | 15% | 39% | 39%
internal/fetch0% | 12% | 34% | 14% | 38%
internal/postgres0% | 2% | 24% | 26% | 47%
internal/symbol0% | 9% | 47% | 12% | 29%
internal/frontend0% | 0% | 25% | 27% | 46%
internal/worker0% | 0% | 20% | 35% | 44%
static/shared0% | 0% | 26% | 18% | 54%
devtools/cmd0% | 0% | 37% | 6% | 56%
internal/config0% | 0% | 37% | 8% | 54%
internal/licenses0% | 0% | 38% | 10% | 50%
internal/stdlib0% | 0% | 29% | 19% | 50%
cmd/frontend0% | 0% | 70% | 0% | 29%
internal/database0% | 0% | 13% | 31% | 54%
cmd/worker0% | 0% | 64% | 21% | 13%
internal/source0% | 0% | 16% | 26% | 56%
cmd/pkgsite0% | 0% | 43% | 43% | 13%
internal/version0% | 0% | 34% | 15% | 50%
internal/memory0% | 0% | 29% | 31% | 39%
internal/fetchdatasource0% | 0% | 10% | 22% | 67%
internal/queue0% | 0% | 13% | 51% | 35%
internal/proxy0% | 0% | 0% | 28% | 71%
internal/middleware0% | 0% | 0% | 20% | 79%
internal0% | 0% | 0% | 20% | 79%
cmd/internal0% | 0% | 0% | 58% | 41%
internal/testing0% | 0% | 0% | 8% | 91%
static/frontend0% | 0% | 0% | 18% | 81%
internal/static0% | 0% | 0% | 40% | 60%
internal/log0% | 0% | 0% | 12% | 87%
internal/derrors0% | 0% | 0% | 17% | 82%
internal/dcensus0% | 0% | 0% | 0% | 100%
internal/auth0% | 0% | 0% | 0% | 100%
internal/index0% | 0% | 0% | 0% | 100%
internal/poller0% | 0% | 0% | 0% | 100%
internal/experiment0% | 0% | 0% | 0% | 100%
internal/cookie0% | 0% | 0% | 0% | 100%
static/worker0% | 0% | 0% | 0% | 100%
internal/secrets0% | 0% | 0% | 0% | 100%
static0% | 0% | 0% | 0% | 100%
internal/xcontext0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
func OneLineNodeDepth()
in internal/godoc/dochtml/internal/render/synopsis.go
127 45 3
func findDeclsAndUnresolved()
in internal/godoc/internal/doc/example.go
110 37 3
func playExample()
in internal/godoc/internal/doc/example.go
114 33 3
func()
in internal/symbol/goapi.go
85 28 1
func()
in internal/godoc/dochtml/internal/render/linkify.go
67 27 1
func extractPackages()
in internal/fetch/package.go
137 26 6
func()
in internal/postgres/insert_module.go
99 26 1
func parseMeta()
in internal/source/meta-tags.go
86 25 2
func()
in internal/godoc/dochtml/internal/render/linkify.go
101 25 1
func CompareAPIVersions()
in internal/symbol/compare.go
80 25 3
private handleKeydown()
in static/shared/outline/tree.ts
73 24 1
func()
in internal/frontend/404.go
85 23 1
func parseRow()
in internal/symbol/apigodoc.go
85 23 1
func LatestModuleVersions()
in internal/fetch/latest.go
84 22 4
func previousFetchStatusAndResponse()
in internal/frontend/404.go
60 21 5
func()
in internal/worker/fetch.go
108 21 1
func docToBlocks()
in internal/godoc/dochtml/internal/render/render.go
41 21 1
func fetchMainDetails()
in internal/frontend/main.go
106 20 6
func()
in internal/frontend/unit.go
97 20 1
func()
in internal/symbol/generate.go
89 20 1