A0012 large-blobs¶
Rule: No git-tracked file is over the size limit outside the allow list.
| Code | A0012 (stable, never reused) |
| Id | large-blobs |
| Category | hygiene |
| Source | spirit_level |
| Fix | by hand |
| Needs | git installed |
Level per tier¶
| Tier | Level | Reason |
|---|---|---|
| small | off | |
| small-workspace | off | |
| medium | off | |
| big | off | |
| ai | warn |
a large tracked file stays in every clone forever; agents commit dumps and binaries with git add -A |
| embedded | off | |
| ui | off | |
| egui | off | |
| units-strict | off | |
| units-paranoid | off |
Parameters¶
| Name | Type | Default | Meaning |
|---|---|---|---|
max-bytes |
integer | 1000000 |
the size in bytes a tracked file may reach before it is flagged |
allow |
list of strings | [] |
globs of tracked files allowed past the limit |
Why¶
A large file in git stays in every clone and every fetch forever, even after it is deleted: a database dump, a build artifact, a dependency vendored by mistake, a video pasted into a commit. Unlike a working tree, history cannot shrink without rewriting it.
The rule lists the tracked files (git ls-files) over max-bytes that match no glob in allow.
How to fix¶
Remove the file from the working tree and keep it out of git (download it in a build step, generate it, or
replace it with a smaller fixture). A file that belongs in git on purpose (a release asset, a seeded corpus) gets
its glob added to allow with a reason.
Configure¶
[lints.large-blobs]
level = "deny"
max-bytes = 1000000
allow = []
reason = "why this project wants it at this level"
Allow one finding in the code with // spirit-level: allow(large-blobs) <reason> (waivers); the code works there too, as in [lints.A0012].