Skip to content

Conversation

@tumf
Copy link
Owner

@tumf tumf commented Sep 6, 2025

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:

    1. uv run make check (falls back to make check if uv is not available)
    2. uv run make coverage (falls back to make coverage if uv is 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 .githooks and ensures the pre-commit hook is executable. The script does not accept options and will not overwrite an existing core.hooksPath set to a different value.

  • Makefile: Added install-pre-commit target which runs .wkm/bin/install to enable the hook for the repository.

How to use:

  1. Run make install-pre-commit in the repository root to enable the local pre-commit hooks.
  2. On commit, the hook will run the checks and coverage. If checks fail, the commit will be prevented.

Notes:

  • The hook prefers uv to run the make tasks; if uv is not installed it falls back to make.
  • The installer intentionally does not overwrite an existing core.hooksPath. To change an existing value, run: git config --local core.hooksPath .githooks manually.

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 coverage to be run as part of the hook or only as an optional step during installation.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@codecov
Copy link

codecov bot commented Sep 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.27%. Comparing base (00ab19b) to head (1db7d23).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #21   +/-   ##
=======================================
  Coverage   95.27%   95.27%           
=======================================
  Files           7        7           
  Lines         550      550           
=======================================
  Hits          524      524           
  Misses         26       26           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tumf tumf changed the title Add local pre-commit hook and install script Add local pre-commit hook and installer (run checks and coverage before commit) Sep 6, 2025
@tumf tumf merged commit a231411 into main Sep 6, 2025
3 checks passed
@tumf tumf deleted the topic/pre-commit-hook branch September 6, 2025 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants