Static analysis reads your source code. Git log analysis reads your team's behaviour. They answer different questions.
This guide walks through the eight metrics DebtLens computes, how each one is derived from git log alone, and what it tells you about your codebase — and your team.
1. Hotspots
What it measures: which files change most often over a given period.
How to compute:
git log --since="6 months ago" --name-only --pretty=format:"" \
| grep -v "^$" \
| sort | uniq -c | sort -rn
The top 5% of the output is your hotspot list.
Why it matters: Microsoft Research and others have shown that roughly 4% of files concentrate 50% of defects. Hotspots identify those files through behaviour, not syntax. A 400-line file with moderate complexity that changes 300 times in six months is more dangerous than a 2000-line file with high complexity that nobody touches.
2. Complexity × Churn
What it measures: the intersection of cyclomatic complexity and change frequency.
How to compute: run a complexity tool per file (PHPStan, lizard, Cloc), then multiply each file's complexity score by its change count from hotspot analysis.
Why it matters: complex + frequently-changed = highest defect probability. These files slow every engineer who touches them and are the #1 source of regressions. This is the quadrant to clean first.
3. Temporal coupling
What it measures: files that consistently change together in the same commits.
How to compute: for each pair of files (A, B) appearing in the history, count the commits where both are modified. Divide by the number of commits where either is modified. The result is the coupling index, 0 to 1.
Why it matters: temporal coupling reveals architectural debt that static analysis misses. Two files that always change together have hidden coupling — touching one tends to require touching the other, even when there's no import relationship. This is where refactoring unpredictability comes from.
4. Knowledge silos
What it measures: per-file author concentration.
How to compute:
git log --follow --pretty=format:"%ae" <file> \
| sort | uniq -c | sort -rn
For each file, compute the share of commits held by the top author. Silo risk is the file-weighted average of those shares.
Why it matters: when the single author of a critical module goes on vacation, changes teams, or quits, nobody else can safely modify the code. Knowledge silos are a direct operational risk — your bus factor.
5. Dead code
What it measures: files unchanged for a long period in an otherwise active repository.
How to compute: for each file, compute the ratio of days_since_last_change / repo_age_days. Flag files above 0.8 in repos with active recent development.
Why it matters: dead code increases onboarding time, confuses new engineers, and inflates metrics. Cleaning it up is the lowest-risk, highest-ROI intervention — often a few hours per file for a team-wide benefit.
6. Velocity trend
What it measures: the ratio of feature commits to bug fixes to refactoring over time.
How to compute: classify each commit by message pattern:
feat:,feature:,add:→ featurefix:,bugfix:,hotfix:→ bug fixrefactor:,chore:,style:→ maintenance
Compute the ratio per month. Look at the trend over six months.
Why it matters: a healthy team spends most of its time on features. When bug fixes start to dominate, the team is firefighting instead of building. This is the clearest signal that debt is costing real velocity.
7. Merge discipline
What it measures: the rigour of the code review process.
How to compute:
git log --merges --pretty=format:"%an|%ae|%cn|%ce"
For each merge commit, compare author name/email (who wrote the code) to committer name/email (who merged it). Self-merges are those where they match. Also count unique reviewers per merger and average diff size.
Why it matters: two repositories with identical static-analysis scores can have radically different quality cultures. One has PRs with two reviewers and small diffs; the other has 60% self-merges and 400-line PRs. The second will ship more bugs despite identical code quality on paper.
8. AI governance
What it measures: the share of AI-generated commits and whether they were reviewed.
How to compute: scan commit messages and trailers for signatures:
Co-Authored-By: Claude <noreply@anthropic.com>Co-Authored-By: GitHub Copilot- Bot authors:
dependabot[bot],renovate[bot] - Characteristic phrasings in commit messages
Cross-reference with merge commit metadata to flag AI-assisted commits merged without human review.
Why it matters: in 2026, every team has AI in their codebase. The question is not whether — it is how much, and how much of it has been reviewed. This is the governance metric regulators, insurers, and enterprise procurement will ask about within the next eighteen months.
What you can do without a tool
Every metric above can be computed by hand with git, awk, and a few SQL queries. For a one-off audit on a small-to-mid-sized repo, that's a reasonable weekend project. You don't need DebtLens for that.
What DebtLens adds is consistency, historical tracking, cost translation into euros, a Claude-written narrative for leadership, a PDF ready to forward, and a five-slide "Board export" for budget meetings. If you're computing these metrics regularly for a team of engineers, the time saved pays for the subscription in the first month.