Code Maps

How we measure

Every number on the map comes from a formula you can read. Here they are, drawn.

From repository to city

Four steps, all of them on your machine.

In the local version, nothing but the chat leaves your machine.

Anatomy of a building

One folder with code in it. Nine things about it are readable at a glance.

3 1 11 19 1 2 3 4 5 6 7 8 9
  1. 1Red mast — hotspot
  2. 2Height = complexity: 1.5 + 1.1 × √complexity
  3. 3Steps appear above 11 and 19 units tall
  4. 4Facade colour = the active lens
  5. 5Width = √files
  6. 6 vulnerabilities and misconfigurations, coloured by the worst one
  7. 7 possible secrets — the value is never shown
  8. 8Rooftop = district colour
  9. 9Heartbeat = it has a critical

What “complexity” counts

Decision points per file, summed per folder. A fast heuristic, not full cyclomatic complexity.

export function settle(orders, rates) {  let total = 0;   (const order of orders) {     (!order.paid  order.voided) continue;    const rate = rates[order.currency];     (order.items.length  rate) {      const item = order.items.pop();      switch (item.kind) {         'refund': total -= price(item, rate); break;         'fee':    total += fee(item, rate);   break;      }      try { audit(item); }  (e) { report(e); }    }  }  return total;}

8decision points in this file

The folder adds up all of its files

  • settle.js8
  • invoice.js14
  • tax.js5

billing/27

Building height7.21.5 + 1.1 × √27

Click a decision point to remove it, as if you had simplified the code, and watch the tower come down.

switch and try are not counted — only if for while case catch && ||.

Where findings come from

Three instruments. Two are standard tools; the third is a handful of rules with no tool behind it.

  • Trivy

    ReadsLockfiles and manifests (npm, yarn, pnpm, pip, poetry, go.mod, Cargo, pom, gradle), built jars for Java, and Dockerfile, compose, Kubernetes and Terraform.

    EmitsVulnerabilities and misconfigurations. Severity is Trivy’s.

  • gitleaks

    ReadsThe working tree, with the default rule set.

    EmitsPossible secrets, all counted as High today: they are not yet sorted into likely and doubtful, and that inflates risk. Only the rule and file:line are kept.

  • Debt rules

    ReadsEvery source file, plus commit counts from git.

    EmitsTODO/FIXME/HACK/XXX = Low · over 500 lines = Medium · more than 0.25 branches per line in files over 50 lines = Medium · hotspot (commits × complexity in the top 5% of the repo) = High.

  • SARIF reports

    ReadsThe .sarif files you drop into .codemap/: Snyk, Semgrep, CodeQL, ESLint, Checkov and any tool that exports SARIF 2.1.0.

    EmitsWith a security-severity: a vulnerability (≥ 9 Critical, ≥ 7 High, ≥ 4 Medium). Without one: debt, Medium for error and Low otherwise. Whatever the tool suppressed stays out.

Four severities

  • Critical
  • High
  • Medium
  • Low

Hotspots

Every dot is a real folder of expressjs/express: to the right, how much it changed over the last 12 months; upwards, how much logic it holds. The 5 % with the largest product of the two gets a red mast.

1101001101001000 stable & simple busy but simple complex but quiet changes a lot AND is complex: where bugs live top 5 % frontier examples/auth · 1 × 17 test/acceptance · 1 × 14 examples/route-middleware · 1 × 6 examples/search · 1 × 6 examples/ejs · 1 × 3 lib · 15 × 287 test · 16 × 247 libtestexamples/auth commits (change) complexity
  • One folder (one building). Hover to see which.
  • Hotspot: a red mast on the map and a High debt finding.
  • Frontier: constant commits × complexity. The axes are logarithmic, which is why it is a straight line.

Risk of one building

The weights

Every finding standing on the building adds its weight. That sum is the risk.

From risk to colour

Logarithmic, so one critical already shows and a hundred do not saturate.

1 High = 5 → 0.41 1 Critical = 10 → 0.55 10 secrets = 50 → 0.89 04080 01 risk

The grade, live

These sliders feed the product’s own scoring function — the same module the dashboard imports. Move them.

Findings

Real repositories:

react/react really carries 215 critical and 1,124 high findings, past the top of the sliders. The security penalty is capped at 50 either way, so the grade does not move.

50
200
300
4
488
751,838

Inspection report

Score: 47 / 100 · Grade: D

47out of 100

Where the points go

  • Start100
  • Security −50.0cap 50
  • Secrets −0.8cap 20
  • Debt −1.9cap 30

The scale

A ≥ 90 · B ≥ 75 · C ≥ 60 · D ≥ 40 · E below.

The four lenses

The same city, four values, one ramp. Each lens normalises to 0–1 and paints the facades.

  • Risk

    Decide what to fix first.

    no findingscritical

    log(1 + risk) / log(81)Logarithmic: one critical already shows, a hundred do not saturate.

  • Debt

    Plan refactors and see which district is rotting.

    0 h16 h or more

    hours / 1616 hours is two working days: from there on, full red.

  • Pulse

    Tell living code from sleeping code. Asleep and risky is the worst combination.

    a year agotoday

    1 − days / 365Touched today = 1; untouched for a year = 0.

  • Traffic

    Find the corridors the whole team walks down.

    0 commitsthe busiest

    commits / max(commits)Relative to the busiest building in the repository.

The same eight buildings, painted by each lens.

Ground heatEvery building radiates its value onto the ground. The district plate is tinted by mean × 1.3 and peak × 0.5.

Districts and links

How a path becomes a district

Links

billing model api stripe imports used by

External packages are ignored: only imports that resolve inside the repository become links.

Honest limits

  • The grade is a heuristic to compare and prioritise, not a standard.
  • Complexity is a token count, not real cyclomatic complexity.
  • Secret scanners flag examples in docs and tests.
  • Without a lockfile or built artifacts there are no dependency findings.
  • On your machine there is no plan limit; there is a technical cap of 10k files per repository, adjustable. In Cloud the size depends on the plan.
  • Pulse and Traffic look at the last 12 months of git. A clone without history leaves them empty, and the map says so.
  • The grade thresholds are not calibrated against a corpus of repositories: they compare two versions of the same code well, not two companies.

Read the code Ask us something