M0016 justfile-simple¶
Rule: Justfile recipes only call programs: a few lines, no inline scripts.
| Code | M0016 (stable, never reused) |
| Id | justfile-simple |
| Category | repo |
| Source | spirit_level |
| Fix | by hand |
Level per tier¶
| Tier | Level | Reason |
|---|---|---|
| small | off | |
| small-workspace | off | |
| medium | off | |
| big | warn |
recipes call programs; logic lives in Rust where it is tested |
| ai | off | |
| embedded | off | |
| ui | off | |
| egui | off | |
| units-strict | off | |
| units-paranoid | off |
Parameters¶
| Name | Type | Default | Meaning |
|---|---|---|---|
max-lines |
integer | 8 |
command lines a recipe may have |
Why¶
A recipe calls a program; it does not hold one. Logic in a shebang recipe or a long chain of shell lines is untested, unportable and invisible to the type checker. It belongs in Rust (a subcommand or a small tool), where it is tested, and the recipe calls it.
How to fix¶
Move the logic into a command and let the recipe call it in a line or two. A recipe may have up to max-lines command lines; comment lines do not count.
Configure¶
[lints.justfile-simple]
level = "deny"
max-lines = 8
reason = "why this project wants it at this level"
Allow one finding in the code with // spirit-level: allow(justfile-simple) <reason> (waivers); the code works there too, as in [lints.M0016].