From 0d504294b52d17597cd5082cedcd1bd79e452541 Mon Sep 17 00:00:00 2001 From: sneak Date: Sat, 9 May 2026 21:39:32 +0200 Subject: [PATCH] Pre-commit hook runs lint+fmt-check, not full check (TDD) Tests are deliberately excluded from the pre-commit hook so that the TDD red-phase commit (failing tests landing before implementation) can land on a feature branch. CI still runs full make check via docker build so a red branch cannot reach main. --- Makefile | 8 ++++++-- README.md | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 381241f..b7c0900 100644 --- a/Makefile +++ b/Makefile @@ -36,6 +36,10 @@ docker: docker build -t quack . hooks: - @printf '#!/bin/sh\nset -e\nmake check\n' > .git/hooks/pre-commit + @printf '#!/bin/sh\nset -e\nmake lint\nmake fmt-check\n' > .git/hooks/pre-commit @chmod +x .git/hooks/pre-commit - @echo "Installed pre-commit hook (runs make check)." + @echo "Installed pre-commit hook (runs make lint && make fmt-check)." + @echo "Note: tests are deliberately not in the pre-commit hook so the" + @echo "TDD red-phase commit (failing tests, no implementation yet)" + @echo "can land. CI runs make check via docker build, which catches" + @echo "any branch that ships red." diff --git a/README.md b/README.md index f739265..e1f52c1 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,11 @@ All work on quack is test-driven. No exceptions. test-then-implementation sequence into reviewable commits, but the final history must still show tests landing before (or with) the matching implementation. +8. The pre-commit hook installed by `make hooks` runs + `make lint && make fmt-check`, not the full `make check`. This is deliberate + so the TDD red-phase commit (failing tests, no implementation yet) can land. + The full `make check` runs as part of `docker build .`, which is what CI + executes, so a red branch still cannot reach `main`. ## Design