Every false finding my codebase reader produced on requests, flask, express, cobra, ripgrep and a real in-house monorepo — and what each one actually was.
Dead-code and dependency tools all fail the same way. You run one on a repository you know, it tells you eleven files are unused, you check three, all three are alive, and you never open it again. The tool was not wrong about static reachability. It was wrong about what reachability means in a real project.
I spent a day pointing one at six codebases in four languages and fixing every answer that was not true. Here is the whole list, because the failures are more instructive than the successes — and because every one of them is a thing your current tool is probably still doing.
First run on a repository with generated test fixtures: 74 seconds, 549,826 files. The data a test writes is not source, and it is not committed. Walking the directory tree is both slower and wrong.
git ls-files -z
0.02 seconds, 67 files, and .gitignore is honoured for free because git already
did that work. If the project is a git checkout, its own file list is the right answer.
A monorepo with backend/pyproject.toml and frontend/package.json and
nothing at the root. Result: every single import reported as an undeclared dependency —
about 130 confident findings, all noise. Looking one level down fixes it, and it is also where the
real commands live: the report had been leading with 33 stray scripts while
cd frontend && npm run dev went unmentioned.
Alembic runs every file in versions/. Django loads migrations/.
pytest collects conftest.py. Nothing imports any of them, and all of them run.
That was 248 false findings on one repository.
vite.config.ts, eslint.config.js, everything in
scripts/. Run by a tool, never imported. Same for anything with a shebang.
In Python, ..mod means two package levels up. In JavaScript,
../lib/api is path arithmetic. Treat them the same and
'../lib/api' resolves against the filesystem root and silently disappears — so
lib/api.ts, imported by half the application, lands in the dead-code list.
The dangerous bugs in this class are the silent ones. A resolver that throws gets
fixed. A resolver that returns None produces a confident, wrong, plausible-looking
report.
const found = import.meta.glob<{ default: ComponentType }>('./*.tsx')
Nine lazily registered widgets, every one reported unused. Two separate problems: the pattern has to survive the TypeScript generic between the name and the call, and the glob has to be expanded and matched against real paths. Both are doable. Pretending the files are dead is not.
When the target is a variable — importlib.import_module(name), a dynamic
import() — no static reader can know what is loaded. The honest move is to resolve
the literal cases, count the rest, and print a warning on the dead-code section saying it cannot be
trusted in this repository. A tool that knows the limits of its own method is worth more than one
that is confidently wrong.
from . import gitinfo
The module name is in the alias list, not in node.module. Drop it and every module
imported that way looks dead. I found this by running the tool on itself.
A dist-prev/ folder someone committed: fifteen hashed asset bundles in the
dead-code list, and the line count inflated by a few thousand lines of minified JavaScript.
node:path is a Node builtin. setuptools is the build system.
cStringIO is Python 2. None of them belong in a missing-dependency list.
try: importtry:
import simplejson as json
has_simplejson = True
except ImportError:
import json
if has_simplejson:
from simplejson import JSONDecodeError
That is from requests. The author has plainly handled the package being absent. Calling
it a missing dependency is the tool failing to read Python. Note the second import, outside the
try — which is why "every import must be guarded" is the wrong rule, and "handled
anywhere means optional" is the right one.
flask imports docutils in docs/conf.py and
pytest in its tests. Neither will break an install. Mixed into one list they are
noise; on their own line — "missing, but only for tests, docs or examples" — they are a real,
small, fixable finding.
Four private keys in requests, all under tests/certs/, all committed on
purpose. Worth listing. Not worth putting at the top of a report as if production had leaked.
Point a Python/JavaScript import graph at a Go and Rust repository and you get "0% test-reachable, 2 dead files". Both statements are fabrications about files the tool never read. The fix is to exclude them and say so in the report.
On a --filter=blob:none partial clone, git log --numstat needs file
contents, so git quietly starts fetching every missing blob. My run went past two minutes before I
killed it. A tool that claims to only read your repository must detect that and decline.
This is my favourite, because the tool was wrong about a language feature in order to be wrong
about dead code. Three live modules in globset — ripgrep's glob matcher — came out as
unreachable. The modules are declared at the top of lib.rs:
mod fnv;
mod glob;
mod pathutil;
Plainly alive. But above them sits a doc comment that documents glob syntax, and it contains this:
/*!
Match globs such as `src/**/*.rs` across platforms.
*/
Look at src/**/*.rs as bytes rather than as a glob. It contains /*,
and then it contains */. Rust block comments nest, so the compiler counts one
opened and one closed, and the comment continues to the real */. My scanner did not
nest, ended the comment at the first */ inside the glob pattern, and treated the
remaining prose as code — losing 354 lines of the file, including every mod
declaration below it.
Go block comments, for the record, do not nest. So this is not one rule but two, and a shared scanner has to be told which language it is reading.
The same pass had to learn that '"' is a Rust character literal and not the start
of a string — otherwise that quote opens a string that runs to the end of the file — while
&'a str is a lifetime and not a character literal at all. The closing quote is
what tells them apart.
After all fourteen, pointed at three well-maintained repositories, the tool reports no missing production dependencies on any of them — because there are none. Pointed at a real in-house monorepo, it found 14 undeclared imports and 8 dead files that were all genuinely undeclared and genuinely dead.
That is the only benchmark that matters for this kind of tool: silence on healthy code. Anything that lists findings on requests and flask is telling you about itself, not about them.
All five are here, unedited:
| Repository | Report | What it found |
|---|---|---|
| requests | requests.html | 95% of shipped modules test-reachable, no missing deps, 4 keys all in test fixtures |
| flask | flask.html | 96% reachable, 16 years of history, app.py at 139 commits is the hotspot |
| express | express.html | lib/response.js at 397 commits, 25 demo apps correctly kept out of the headline |
| cobra (Go) | cobra.html | 100% test-reachable, command.go at 252 commits, go.mod read for dependencies |
| ripgrep (Rust) | ripgrep.html | 63% reachable by import — most of its testing is integration tests that run the built binary, which no import graph can see |
That last line is the kind of finding worth having. 63% is not a complaint about ripgrep's testing; it is a true statement about what imports reach, and the gap is exactly where a static reader has to admit what it cannot see.
The tool is Repo X-Ray. Python, JavaScript/TypeScript, Go and Rust get the full import graph; any other language is inventoried and explicitly not judged by a graph that never read it. It executes nothing, needs no network, has no dependencies, and writes one self-contained HTML page you can hand to a client.