Add local pre-commit hook and installer (run checks and coverage before commit) #21
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a repository-local pre-commit hook and a simple installer to enable it. Changes:
.githooks/pre-commit: New pre-commit hook that runs the test/check pipeline before allowing a commit. It executes:
uv run make check(falls back tomake checkifuvis not available)uv run make coverage(falls back tomake coverageifuvis not available)Both steps must succeed; if either step fails, the hook exits non-zero and the commit is aborted.
.wkm/bin/install: Installer script that sets
git config --local core.hooksPath .githooksand ensures the pre-commit hook is executable. The script does not accept options and will not overwrite an existingcore.hooksPathset to a different value.Makefile: Added
install-pre-committarget which runs.wkm/bin/installto enable the hook for the repository.How to use:
make install-pre-commitin the repository root to enable the local pre-commit hooks.Notes:
uvto run the make tasks; ifuvis not installed it falls back tomake.core.hooksPath. To change an existing value, run:git config --local core.hooksPath .githooksmanually.This change is intended to prevent commits that would fail the repository checks and to make enabling the hook easy for contributors.
Please review and let me know if you want
coverageto be run as part of the hook or only as an optional step during installation.