Skip to content

Commit c1e4522

Browse files
committed
AGENTS.md: add pre-commit checklist for lint checks
Bundle the existing ASCII-only, 80-column, and whitespace validation recipes into a "pre-commit checklist" block that agents should run before every commit. The individual recipes already existed in the Coding Conventions section but were presented as reference material rather than as an actionable workflow step. Signed-off-by: Johannes Schindelin <[email protected]> Assisted-by: Claude Opus 4.6
1 parent 18c1fd2 commit c1e4522

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

AGENTS.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,22 @@ terminal sessions of yore:
975975
- **Tabs for indentation**: The codebase uses tabs, not spaces.
976976
- **No trailing whitespace**: Clean up your lines.
977977

978+
**Pre-commit checklist.** Run all three checks before every commit:
979+
980+
```bash
981+
git diff --check &&
982+
git diff --no-color | LC_ALL=C grep '[^ -~]' &&
983+
echo "ERROR: non-ASCII characters found" &&
984+
git diff --no-color | grep '^+' | sed 's/\t/ /g' |
985+
grep '.\{82\}' &&
986+
echo "ERROR: lines exceed 80 columns"
987+
```
988+
989+
The first command catches whitespace errors. If either of the latter
990+
two produces output, fix the offending lines before committing. Note
991+
that these checks apply to commit messages as well (wrap at 76 columns
992+
for messages, 80 for code).
993+
978994
See `Documentation/CodingGuidelines` for the full set of conventions.
979995

980996
### strbuf patterns

0 commit comments

Comments
 (0)