Your Linter's Default Rule Set Is a Time Bomb

If you adopt a linter and don’t tell it which rules to enforce, you have handed a third party the ability to fail your CI on code you didn’t change. They will exercise it. Not out of malice — because their defaults get better, and “better” means “more rules.”

I hit this while standardising Python tooling across a few repositories, and the near-miss was sharp enough that it’s now a rule I won’t skip.

The near-miss

One service pinned its linter through a lockfile at version 0.12.4, with no explicit rule selection. Clean CI. Had been clean for months. Nobody had touched the lint config since it was added.

Out of curiosity I ran the version we were standardising on — 0.16.4 — against that same untouched codebase.

393 findings. Plus three files the formatter wanted to rewrite.

Not one line of application code had changed. Between those two releases the tool’s default rule set had widened, and every new rule applied retroactively to code written before the rule existed. That repository was exactly one lock --upgrade away from a red build and an afternoon of triage, and the commit that triggered it would have been a routine dependency refresh with an innocent diff.

That’s the shape of the trap. It isn’t that defaults are bad. It’s that defaults are a moving target you’ve agreed to track, and you agreed to it implicitly. The blast radius lands on whoever happens to bump the lockfile, which is rarely the person who chose to inherit the defaults.

The fix is boring

Two lines of config, both non-negotiable:

# ruff.toml
[lint]
select = ["E4", "E7", "E9", "F", "I", "UP"]
# CI
- run: pip install ruff==0.16.4

Explicit rule selection, pinned version. Now a version bump changes behaviour of the rules you chose rather than which rules exist, and upgrading is a deliberate act with a reviewable diff.

The rule set above is deliberately narrow: pycodestyle errors, a subset of pyflakes, import sorting, and pyupgrade. What they have in common is that they’re mechanical — a machine can fix them and the fix cannot change what the program does. Import order, string formatting, unused imports, undefined names.

What I deliberately left out is everything opinionated: blind-except detection, subprocess security heuristics, comprehension rewrites, “modernise this loop” suggestions. Those rules are often right, but their fixes change behaviour, which means they can’t be applied automatically and they turn every lint failure into a design conversation. A linter that makes you think is a linter people disable. I’d rather enforce a small set nobody argues with than a large set with a growing # noqa population.

Two side traps from the same migration

A static binary still needs a package manager to install it. The tool ships as a self-contained binary with no runtime dependency — so when I removed the Python setup step from the CI job as dead weight, that felt safe. The job failed in seven seconds:

pip: command not found

The binary doesn’t need Python to run. It needs pip to arrive. Our ARM CI runners have no Python preinstalled, so the setup step everyone assumes is vestigial was doing the only thing that mattered. The previous tool’s job had carried the same step for the same reason, and I’d read it as cargo cult. It was load-bearing.

The general version: “this tool has no runtime dependencies” and “this tool has no install dependencies” are different claims, and CI only cares about the second one.

“Respects .gitignore” does not mean “skips files you aren’t tracking.” Modern linters skip ignored paths by default, which sounds like it covers vendored code. One repository had roughly 247,000 vendored Python files from a bundled dependency — untracked, but never actually added to .gitignore. Nobody had noticed, because nothing had ever walked the tree before.

Gitignore-awareness keys off ignore rules, not off tracked status. Untracked-and-not- ignored is a real state, it’s common in vendored directories, and it’s the worst case for a recursive linter. That repo needs an explicit exclude, and the honest fix — actually gitignoring the vendored tree — is a separate change I haven’t made yet.

Takeaways

None of this is clever. It’s the kind of thing that costs ten minutes to set up and a full afternoon to debug six months later, on a day you’d planned to do something else, in a pull request that looks like it changed nothing at all.


← all writing