G0004 crate-table¶
Rule: The crate table in the README is the one generated from the manifests and the map.
| Code | G0004 (stable, never reused) |
| Id | crate-table |
| Category | graph |
| Source | spirit_level |
| Fix | exact: spl check --fix applies it |
Level per tier¶
| Tier | Level | Reason |
|---|---|---|
| small | off | |
| small-workspace | off | |
| medium | off | |
| big | deny |
the crate table is generated from the manifests and the map, never written by hand |
| ai | off | |
| embedded | off | |
| ui | off | |
| egui | off | |
| units-strict | off | |
| units-paranoid | off |
Parameters¶
| Name | Type | Default | Meaning |
|---|---|---|---|
file |
string | "README.md" |
the file holding the table between its markers |
Why¶
A big workspace keeps a table of its crates (name, layer, one-line description) where readers look first. Written by hand it drifts; generated, it is always the truth. Each crate's description is written once, in its Cargo.toml, and its layer in the map (rerun generates its ARCHITECTURE.md tables from cargo metadata the same way).
The table sits in the file named by file, between two marker lines:
<!-- spirit-level:crates -->
| Crate | Layer | Description |
|---|---|---|
| [`foo_core`](crates/foo_core) | model | Types of foo: ids, units, errors |
<!-- /spirit-level:crates -->
Crates are ordered by their layer's place in the map, then by name.
How to fix¶
spl check --fix regenerates the table. To change a row, edit the crate's description or its map entry.
Configure¶
[lints.crate-table]
level = "deny"
file = "README.md"
reason = "why this project wants it at this level"
Allow one finding in the code with // spirit-level: allow(crate-table) <reason> (waivers); the code works there too, as in [lints.G0004].