Skip to content

Fix rate ​

This lens answers: when someone changes this file, how often do those very lines need fixing within a month, and is that more than you'd expect by luck in this repository? A file where changes keep needing repair is fragile in a way churn can't show: it changes often and its changes don't hold.

Its biggest limit: a commit only counts as a fix if its subject line says so, and it can only be traced if it changed or removed lines. A real fix described as "handle empty list", or one that only adds a missing check, leaves no trace. So read a rate as a signal to go and look, not as a count of bugs. The numbers are usually small.

Reading the numbers ​

What you seeWhat it means
"One file is fixed more often than chance: lexer.rs (4 of 18)"4 of the 18 changes to this file were followed within 30 days by a fix of the lines they wrote. That's more than luck explains at this repository's rate. Up to three files are named, then "and N more."
"Repo-wide, 2.6% of changes needed a fix within 30 days"The rate across every rated change in the repository, including changes to files with too few changes to get a rate of their own. This is the number each file is tested against.
"No file is fixed more often than chance"No file stands out. It doesn't mean nothing needs fixing: the repo-wide rate beside it could be high, as in the Python example below. If no file has a rate at all, this line still prints, so check the rated count above it.
"1 file above chance, of 9 rated"Files above chance, out of the files with a rate.
A changeOne commit touching one file. A commit touching three files is three changes. Fix commits are changes too, so a fix can itself be fixed.
"4 of 18 changes fixed within 30 days"4 changes had a fix traced to them. A change fixed twice counts once. A single fix that repairs three changes adds three.
"Chance allows up to 2 at this size: above chance"With this many changes, at the repo's rate, luck alone can plausibly give up to 2 fixed. This file has more. See What "against chance" means.
"chance at 2.6%"The label on the shaded band, which is what chance gives at the repo's rate.
"34 files have fewer than 8 changes old enough to rate; widen the window (--since all) for more"These files have at least one rated change, but not the 8 a rate needs. The part after the semicolon appears only when the report covers a limited period.
"No file has 8 changes older than 30 days yet; widen the window (--since all) for more."The picture when no file has a rate. The inspector may still give a repo-wide rate. On a report covering all of history, the wording stops at "yet."
"No change is old enough to rate yet."Everything in the analyzed period is less than 30 days older than its newest commit.
"Fix rate traced the newest 20,000 of 20,150 fixes; changes before Feb 7, 2010 aren’t rated."A very large history hit the cap on traced fixes. See When the trace is cut short.
"This report predates fix rate; re-run gitrelic."The report has no fix rate data. Usually it's an old saved report, but a failed analysis says the same thing. See When the trace is cut short.
"0%"Rates round to one decimal under 10% and to a whole number above, so a very small rate can read 0%. The counts are the numbers to trust.

This lens has its own wording for the floor because it counts changes old enough to rate. The "N of M files have 8+ commits" line you'll see on lenses such as Risk counts commits in the period, and it doesn't appear here.

The table's tiers are No fix, One fix, Several fixes and Above chance. Only the last one is a verdict. A file with several fixes that's within chance isn't flagged.

Four example repositories ​

These repositories are invented, but each result is what GitRelic reports for commits like these.

A Rust workspace where one file stands out ​

1 file above chance, of 9 rated

One file is fixed more often than chance: lexer.rs (4 of 18). Repo-wide, 2.6% of changes needed a fix within 30 days.

34 files have fewer than 8 changes old enough to rate; widen the window (--since all) for more

What it means: at 2.6%, a file with 18 changes would expect about half a fixed change. Luck reaches 2 fairly easily, about 1 time in 13. It reaches 4 about 1 time in 900, so this isn't luck. In the same repository, resolve.rs has 2 of 38 (5.3%). That's twice the repo's rate, but with 38 changes it's well within chance, and the lens doesn't flag it.

What to look at: select lexer.rs. The inspector says "Review its changes closely" and lists its fixes, and the fix chain shows which changes each one repaired. If different people's changes keep needing repair, the file is probably hard to change safely. Whether that's the design or missing tests is for you to judge: this lens only says that something is there to find.

A Python app where everything needs fixing ​

0 files above chance, of 8 rated

No file is fixed more often than chance. Repo-wide, 9.3% of changes needed a fix within 30 days.

What it means: this isn't a clean bill of health. Nearly one change in ten needs a fix, and the worst file, tasks.py at 4 of 26 (15%), is within what chance gives at that rate. Testing against the repo's own rate finds outliers. It can't say that the whole repo is high, because a high rate raises the bar for every file.

What to look at: the repo-wide number. The problem here isn't one file, and picking a file to refactor won't address it. A rate this high is unusual: on the repositories GitRelic has been tried on, rates sit in the low single digits.

A careful Java service where one fix is enough ​

One file is fixed more often than chance: Ledger.java (1 of 9). Repo-wide, 0.2% of changes needed a fix within 30 days.

1 of 9 changes needed a fix within 30 days; 0.2% repo-wide.

What it means: at a rate this low, chance allows no fixes at all for a file with 9 changes, so a single fix flags it. In the same repository, Invoice.java also has one fix, in 27 changes (1 of 27), and it isn't flagged, because chance allows one at that size.

What to look at: read that one fix before treating this as a pattern. "Above chance" is a fair statement about a very low rate, but one fix is one event. Once the repo-wide rate falls under about 0.3%, one fix is enough to flag a file with 8 changes.

A small TypeScript library with nothing rated ​

0 files above chance, of 0 rated

No file is fixed more often than chance. Repo-wide, 17% of changes needed a fix within 30 days.

No file has 8 changes older than 30 days yet; widen the window (--since all) for more.

What it means: the first line is the one to read. Nothing was tested, so "no file is fixed more often than chance" says nothing about these files. The 17% is 4 of 24 changes across a repository with 4 files, too few to rely on.

The advice to widen the window prints on any limited period, even when there's nothing older. This library's whole history is under a year, so --since all gives the same result without the advice. The answer here is that the repository is too young for this lens.

How it's measured ​

GitRelic finds the commits that say they're fixes, asks git who wrote the lines each one changed, and counts a change as fixed if a fix reached its lines within 30 days.

What counts as a fix ​

A commit is a fix when its subject line contains one of these whole words, in any capitalization: fix, fixes, fixed, fixing, bug, bugs, bugfix, hotfix, regression, oops, broke, broken. It's a revert when its subject starts with revert, reverts, reverted or reverting.

The match is that literal, so read it both ways:

  • Counted, though not really fixes: "docs: fix typo", "Add regression test", "Add bug report template".
  • Not counted, though they are fixes: "Handle empty list", "Bugfixes for parser", "Hotfixes for parser", "regressions in the parser", "Partial revert of retry". The plural forms aren't on the list.

The rest of the commit message isn't read. Merge commits never count. Commits by bots are left out as fixes and as changes, and lines a bot last wrote aren't traced any further back. AI agents' commits stay in on both sides.

A fix touching more than 20 files isn't traced, because a rename across the codebase would blame every file it passed through. It still counts as a change to each file. That 20 includes every file in the commit, not only the rated ones.

How a fix is tied to the change it repairs ​

For each rated file a fix touched, GitRelic asks git for two things beyond the commit log: which lines the fix changed or removed, and, with git blame, which commit last wrote each of those lines just before the fix. Those commits are what the fix repaired. That's the meaning of "a fix of their own lines."

Here's why that matters. Say parser.rs has these commits:

Ana's change counts as fixed. Sam's doesn't, though it was the most recent change to the file: the fix never touched Sam's line.

  • A fix that only adds lines traces to nothing. It changed no existing line, so there's nothing to ask about. A fix that adds a missing check is the usual case, and it's invisible here.
  • Whitespace is seen through. If someone reformatted a line after writing it, blame names the person who wrote it, not the reformat.
  • A rename since then. A change counts under the path the file had when it was made, so a file that's been renamed is rated only on changes made under its current name. Earlier changes, and fixes of their lines, drop out of its rate.
  • Reverts work the same way: a revert removing a commit's lines traces to that commit. A revert that only restores deleted lines adds lines, and traces to nothing.

Where the 30 days applies ​

The 30 days does two jobs.

  1. Fix to change. A fix counts only if it's at most 30 days after the change, by author date. A fix on day 30 counts and one on day 31 doesn't, even if it rewrites the same line.
  2. Old enough to rate. A change is rated only if it's at least 30 days older than the newest commit in the analyzed period. A change from last week hasn't had its chance to be fixed, and counting it as clean would flatter the newest files. It's measured from the newest commit, not today, so a repository nobody has touched for a year still leaves its last month of commits unrated.

Both ends of a pair must be in the analyzed period. A fix in the period that repairs a change from before it doesn't count.

Which changes and files are rated ​

Only files that still exist in the analyzed commit are rated. Fixtures and generated files are left out, as they are for Ownership: a snapshot update isn't a fix. --include-fixtures brings them back. Project plumbing (manifests, lockfiles, changelogs, licenses, CI and tool configuration) is always left out.

A file needs 8 rated changes. Under that, one fix moves the rate by more than 12 points, which is noise. Those files are counted in the "fewer than 8" line and get no rate. Files with no change old enough aren't in that count at all.

The 8 is the floor every per-file verdict in GitRelic shares: fix rate, Ownership, cursed files and commit timing's author stress, where bots' commits are left out before counting, and blast radius, rewrite ratio and churn velocity, where they're kept. A file with 8 commits, 3 of them a release bot's, has a rewrite score and no ownership risk.

Fix rate is the strictest, because only changes old enough count. A file with 8 commits, one from last week, is rated on other lenses and not here. Its file card shows no Fix rate row, and no Sample row saying why, because the Sample row ("5 commits, under the 8 a verdict needs") counts commits.

What "against chance" means ​

Suppose every change in the repository had the same chance of needing a fix: the repo-wide rate. Some files would still collect more fixes than others, by luck. A file is above chance when luck alone would give it at least this many fixed changes less than 2.5% of the time, or about 1 time in 40, at its number of changes.

The shaded band is the limit of that for each size, and it depends on the repo's rate:

Repo-wide rateAt 8 changesAt 20At 40At 100
0.2%0111
1%1123
2%1235
5%23510
10%35816

Each cell is how many fixed changes chance allows. One more is above chance. So 2 of 8 is above chance at 2%, and it isn't at 5%.

How to read each result:

  • Above the band: more than luck explains here. It's worth reading the fixes, but it isn't proof the file is bad.
  • Inside the band: luck could explain it. That isn't the same as the file being fine, as a few changes can't show much either way.
  • Below it: there's no such verdict. The test only looks upward, and the band goes down to zero, so GitRelic never calls a file better than chance. A file with no fixes in 8 changes means little: at a 5% rate, that happens about two times in three. Even 0 of 40 happens about 1 time in 8.

How sure it is:

  • Some flags will be luck. The test runs on every rated file. At the sizes and rates above, each one gets flagged by luck about 1% of the time (2.5% at most), so among 200 rated files, expect a couple of flags that mean nothing. One file barely above the band in a big repository is weak evidence. Several, or a file far above it, is much stronger.
  • Changes aren't really independent. The test treats each fixed change as a separate event, but one fix repairing three changes adds three. If one fix is behind most of a flagged file's count, it's closer to one event.
  • The repo's rate includes the file. A file that makes up much of the repository lifts the rate it's tested against, which makes it harder to flag.

When the trace is cut short ​

The commit log is one read, and if it fails, there's no report at all. Tracing is different: it runs git separately for every rated file in every fix, and those reads can fail one at a time without stopping the run. The first two cases below can mislead you, because missing fixes look exactly like good code.

What happensWhat GitRelic doesWhat you see
A read hits its limit. Each git read in tracing has 30 seconds, and --git-timeout doesn't change that. That's far longer than a read normally takes, so expect this only on an enormous repository, a slow disk or a heavily loaded machine.That file is skipped for that fix, and the rest carry on.Once, on the terminal: "[gitrelic] fix rate: 9 blames hit the time limit and were skipped." --json output keeps the count. The dashboard says nothing.
Git reports an error on a read. This is normal for the first commit in a history, which has nothing before it, but a real failure looks the same.The fix traces to nothing for that file.Nothing, anywhere.
The history has more than 20,000 traceable fixes.Only the newest 20,000 are traced. Changes before the oldest of those aren't rated, so nothing is counted clean because of a fix nobody traced.The "traced the newest…" line in the inspector, and a line on the terminal. The rate is sound, but it covers less time than the report.
The whole analysis fails. This should be rare.The rest of the report carries on."This report predates fix rate; re-run gitrelic." even on a new report, and a line on the terminal saying the analysis failed and why.

Here's what a skipped read does. Its fix goes uncounted, so that file's rate reads low, and the slowest files to read are usually the biggest and longest-lived, the ones you most want rated. It also pulls down the repo-wide rate, which lowers the bar for everything else, so a different file can tip above chance. If every read fails, the result is:

0 files above chance, of 9 rated

No file is fixed more often than chance. Repo-wide, 0% of changes needed a fix within 30 days.

That's identical to a team that never needs a fix. Treat a 0% repo-wide rate on a large repository with suspicion. Check the terminal output from the run, and run it again if a time-limit line appeared. A saved report can't show you that line later.

A shallow clone misleads in a different way. GitRelic doesn't check for one. Blame names the shallow clone's oldest commit as the author of every older line, so a fix within 30 days of that commit counts it as repaired, even when the real change is much older. Run this lens on a full clone. --repo always makes one.

In the dashboard ​

Find this lens under Code Health. The terminal summary doesn't show fix rate: use gitrelic --web, or --json for the data.

  • The funnel is the picture. Each dot is a rated file: changes across, on a log scale, and the share fixed within 30 days up. The shaded band is what chance gives. It narrows as files get more changes, stepping back up each time chance allows one more fix, because the limit is a whole number of fixes. Dots get a stronger color by tier, files above the band are strongest and named as room allows, and files with no fix sit on a floor under the axis. Files without a rate aren't drawn: the second line under the axis counts them. Hover a dot for its counts, what chance allows and its latest fix.
  • A file's fix chain opens when you select a rated file. Its commits sit evenly spaced along a lane, with months named where they start, because a fix often lands the same day as what it repairs. Fixes are rings, the changes they repaired stand out, changes too recent to rate are faint, and an arc joins each fix to what it repaired. Hover a fix for its subject and date, and a repaired change for what fixed it. Only the five newest fixes are drawn. In a file with more, an older fix and what it repaired look like ordinary changes, with a tooltip saying "No fix traced to it", though the count still includes them.
  • The inspector, with nothing selected, shows the count above chance, the findings quoted above and up to five files with fixes under Fixed most often: above chance first, then by rate.
  • A selected file's card shows Fix rate 22% (4 of 18) under Flagged by, as a warning when it's above chance. Its Activity section says "4 of 18 changes needed a fix within 30 days, more than chance explains." and lists up to five fixes, newest first, with reverts tagged. Above chance, What to do adds "Review its changes closely."
  • The table (T) lists every rated file: changes, fixed after, rate, above chance and latest fix.
  • Elsewhere: the Overview shows "N above chance", the lens gets a badge when any file is above chance, and a file above chance earns a reason on Risk, worth 10 points at the repository's rate and rising to 20 at three times it.

What it can't tell you ​

  • How many bugs a file has. It counts fixes people labeled, of lines that already existed, within a month. A bug fixed by adding code, fixed under another description, or found after 30 days doesn't appear. Don't compare repositories with different commit habits: a team that writes "fix" on everything reads higher than one that doesn't.
  • Whether the blamed change caused the bug. Blame names the last writer of a line the fix rewrote. If a fix also tidies nearby lines, or a commit does a refactor and a fix together, those writers are named too.
  • How your merges shape it. Commits on merged branches count like any others, so a branch where someone commits a feature and then "fix tests" a day later shows a fixed change, though that bug never shipped. A team that squash-merges hides those, and reads lower for the same work.
  • Why a file is fragile. Being hard to change, under-tested, doing too much and simply being where the hard problem lives all look alike.
  • Whether it's getting better. Each rate covers the whole analyzed period. To compare periods, run again with a different --since.
  • About recent work. The last 30 days are never rated, so a file that went wrong last week looks as it did before.
  • Risk — where a file above chance earns points alongside churn and ownership.
  • AI & Co-authors — compares how often AI commits' changes are fixed with everyone else's, using these same changes.
  • Churn — how often a file changes, which says nothing about whether the changes hold.
  • Tests — whether changes ship with a test, a natural next question for a file above chance.
  • Commit Timing — the same chance test, on off-hours commits.

Released under the MIT License.