-
Notifications
You must be signed in to change notification settings - Fork 0
fix(pre-commit): replace pre-commit with shell git hooks and update documentation #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
3930443
564462f
596b455
e25dfb4
9988003
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #!/usr/bin/env bash | ||
| set -e | ||
|
|
||
| ############################################################################### | ||
| # Git pre-push hook | ||
| # | ||
| # Runs formatting and linting checks before pushing. Delegates to the project | ||
| # scripts, which auto-delegate to Docker when run outside the container. | ||
| ############################################################################### | ||
|
|
||
| REPO_ROOT="$(git rev-parse --show-toplevel)" | ||
|
|
||
| echo "=== Pre-push: checking formatting ===" | ||
| "$REPO_ROOT/scripts/format.sh" --check | ||
|
|
||
| BUILD_DIR="$REPO_ROOT/build" | ||
| if [ ! -f "$BUILD_DIR/compile_commands.json" ]; then | ||
| echo "=== Pre-push: skipping clang-tidy (no compile_commands.json) ===" | ||
| echo "Run ./scripts/build.sh first to enable lint checks." | ||
| else | ||
| echo "=== Pre-push: running clang-tidy ===" | ||
| "$REPO_ROOT/scripts/lint.sh" | ||
|
||
| fi | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -15,7 +15,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co | |||||||||||||
| ./scripts/docs.sh # Generate Doxygen documentation | ||||||||||||||
| ``` | ||||||||||||||
|
|
||||||||||||||
| Pre-commit hooks run on **pre-push** (not pre-commit): `pre-commit install --hook-type pre-push` | ||||||||||||||
| Git hooks live in `.githooks/` (version-controlled). Install once after cloning: `./scripts/install-hooks.sh` | ||||||||||||||
|
|
||||||||||||||
| All scripts auto-delegate to Docker when run outside the container (`docker run --rm`). The delegation logic lives in `scripts/docker/exec.sh`, sourced by each script via `scripts/env.sh`. Inside the container or CI (`CI=true`), scripts run directly with no overhead. See `docs/ci-container-delegation.md` for details on the CI strategy and a GHCR upgrade path. | ||||||||||||||
|
||||||||||||||
| Git hooks live in `.githooks/` (version-controlled). Install once after cloning: `./scripts/install-hooks.sh` | |
| All scripts auto-delegate to Docker when run outside the container (`docker run --rm`). The delegation logic lives in `scripts/docker/exec.sh`, sourced by each script via `scripts/env.sh`. Inside the container or CI (`CI=true`), scripts run directly with no overhead. See `docs/ci-container-delegation.md` for details on the CI strategy and a GHCR upgrade path. | |
| Git hooks live in `.githooks/` (version-controlled). Install once after cloning: `./scripts/install-hooks.sh` (runs directly on the host). | |
| All build/test/utility scripts above auto-delegate to Docker when run outside the container (`docker run --rm`). The delegation logic lives in `scripts/docker/exec.sh`, sourced by each script via `scripts/env.sh`. Inside the container or CI (`CI=true`), scripts run directly with no overhead. See `docs/ci-container-delegation.md` for details on the CI strategy and a GHCR upgrade path. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hook runs
scripts/lint.shunconditionally.lint.shrelies on an existing build directory withcompile_commands.json(via-p "$BUILD_DIR"), so this hook will fail on fresh clones / before a first CMake configure. Consider adding a preflight check forbuild/compile_commands.jsonand emitting a clear instruction (e.g., runcmake -S . -B build) before exiting non-zero (or explicitly skipping lint).