Skip to content

P0007 commit-subject-length

Rule: A commit subject stays under its length limit.

Code P0007 (stable, never reused)
Id commit-subject-length
Category commits
Source spirit_level
Fix by hand
Needs git installed

Level per tier

Tier Level Reason
small off
small-workspace off
medium warn the subject is what one-line logs and reviews show
big warn the subject is what one-line logs and reviews show
ai deny the subject is what one-line logs and reviews show
embedded off
ui off
egui off
units-strict off
units-paranoid off

Parameters

Name Type Default Meaning
max-chars integer 60 characters a subject may have
base string "main" the branch work merges into; commits in base..HEAD are checked

Why

The subject is the one line that git log --oneline, review tools and release notes show. Past about 60 characters it is cut off, and a subject that long is usually a body in disguise.

The commits checked are base..HEAD without merges, read with git. When base is not a commit in the repo, a candidate finding says so instead.

commit subject of 82 characters (limit 60): wip: core types, config, model, engine, report, manifest lints

How to fix

Name the change in the subject; move details into the body. Reword with git commit --amend or an interactive rebase on an unpushed branch.

Configure

[lints.commit-subject-length]
level = "deny"
max-chars = 60
base = "main"
reason = "why this project wants it at this level"

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