yak(make-checkverify-format-gate-rewrites-files-instead-of-checking-lnje): make check/verify format gate rewrites files instead of checking

This commit is contained in:
Willem van den Ende
2026-10-28 21:50:01 +00:00
parent a6a7b3a8c7
commit 4e7798c906
4 changed files with 39 additions and 11 deletions
+14 -4
View File
@@ -3,15 +3,17 @@
MISE_BIN ?= mise
MISE_EXEC = $(MISE_BIN) exec --
.PHONY: check precommit deps compile test test.coverage coverage crap format verify
.PHONY: check precommit deps compile test test.coverage coverage crap format format.check verify
# Cheap static gate for this library (no database, no coverage). Runs from the
# root `make check`, which loops app then blogex.
# root `make check`, which loops app then blogex. `format.check` only reports:
# a gate that rewrites the files it judges can never fail. Fix formatting with
# `make format`.
#
# Sensor slot: add `credo` once the "credo strict, tuned config (both apps)"
# yak lands blogex's credo dep + .credo.exs. Do not list it before then — a
# gate that claims a check it did not run is worse than no gate.
check: compile format
check: compile format.check
# Per-app precommit loop: same target name and alias shape as app/, so both
# apps share one habit (compile --warning-as-errors, format, test).
@@ -58,10 +60,18 @@ crap:
@test -f cover/default.coverdata || { echo "crap: no exported coverage - run 'make test.coverage' first" >&2; exit 1; }
MIX_ENV=test $(MISE_EXEC) mix crap
# Format code
# Format code. MUTATES the tree; deliberately not part of `check` (nor of the
# Lens pass), which must never write: a gate that fixes what it judges can never
# fail, and would dirty the tree a push is about to send. `make check` uses
# `format.check` below instead.
format:
$(MISE_EXEC) mix format
# Verify formatting without writing. Fails with the offending files, so the fix
# is explicit: run `make format` (or `make -C blogex format`).
format.check:
$(MISE_EXEC) mix format --check-formatted
# =============================================================================
# Lens pass (heavy checks; root `make verify` runs this before every push)
# =============================================================================