Skip to content

P0017 fixes-tag

Rule: A Fixes: trailer names its culprit by a hash that resolves and the culprit's subject.

Code P0017 (stable, never reused)
Id fixes-tag
Category commits
Source spirit_level
Fix by hand
Needs git installed

Level per tier

Tier Level Reason
small off
small-workspace off
medium warn a Fixes: trailer that points nowhere is worse than none; it fires only where one is written
big warn a Fixes: trailer that points nowhere is worse than none; it fires only where one is written
ai deny an agent copies the culprit's hash and subject from git; a wrong one sends the next reader astray
embedded off
ui off
egui off
units-strict off
units-paranoid off

Parameters

Name Type Default Meaning
trailer string "Fixes" the trailer key that names the commit a fix repairs
min-hex integer 12 hex digits the hash must have
base string "main" the branch work merges into; commits in base..HEAD are checked

Why

A fix that names the commit which brought the bug tells which releases carry the bug, lets tools follow a bug back to its origin, and shows which changes needed fixing later. The name only helps when it is right: a hash too short to stay unique, a hash of another repository, or a subject copied wrong points nowhere.

Reject frames longer than the buffer

Fixes: 3f2a9c1d0b7e ("Read frames into a fixed buffer")

The lint checks each Fixes: trailer of the branch's commits (Commits and landing): the hash has 12 or more hex digits, it resolves to a commit in the history of the fix, and the quoted subject is that commit's subject.

How to fix

Write the trailer as git log -1 --format='%h ("%s")' --abbrev=12 <hash> prints it, in the last paragraph of the message. On the branch, git commit --amend or a rebase rewrites the message.

Configure

[lints.fixes-tag]
level = "deny"
trailer = "Fixes"
min-hex = 12
base = "main"
reason = "why this project wants it at this level"

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