Skip to content

P0005 commit-body-lines

Rule: A commit body stays short.

Code P0005 (stable, never reused)
Id commit-body-lines
Category commits
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 body holds why, not a retelling of the diff
embedded off
ui off
egui off
units-strict off
units-paranoid off

Parameters

Name Type Default Meaning
max-lines integer 5 lines a body may have, trailers not counted
base string "main" the branch work merges into; commits in base..HEAD are checked

Why

A commit body holds what the diff cannot say: why, and what a reader must know. Long bodies retell the diff. Trailers (Co-Authored-By:, Signed-off-by:) are not counted.

How to fix

Keep the reason and the consequences. Explanations of how the code works belong in the code's docs or the book.

Configure

[lints.commit-body-lines]
level = "deny"
max-lines = 5
base = "main"
reason = "why this project wants it at this level"

Allow one finding in the code with // spirit-level: allow(commit-body-lines) <reason> (waivers); the code works there too, as in [lints.P0005].