chore: add pre-commit hook recipes #138
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "chore/pre-commit-hooks"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
install-hooksrecipe (governance[group: 'hooks']pattern fromgovernance/PRE_COMMIT.md): writes a#!/usr/bin/env shstub at.git/hooks/pre-committhat execsjust pre-commit, marks it executable, and is idempotent (removes any leftover symlink from a prior install before writing).pre-commitrecipe that mirrors.forgejo/workflows/check.ymlstep-for-step -cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warnings,cargo build --workspace --all-targets --locked,cargo test --workspace --lib- all run inside the dev composeapicontainer viadocker compose -f compose.dev.yml run --rm --no-deps apiso the toolchain matches CI exactly.-e SQLX_OFFLINE=trueflags added because theapiservice incompose.dev.ymlalready declaresSQLX_OFFLINE: "true"in itsenvironmentblock, so the env var is present in the container for all four steps without extra flags.Opt-in, no behavior change
This PR adds no automated behavior. Contributors opt in once per fresh clone with
just install-hooks. Any single commit can bypass the hook withgit commit --no-verify. Nothing in the existing dev/CI workflow is altered.Test plan
just --listand confirm[hooks]group showsinstall-hooksandpre-commit.just install-hooksand confirm.git/hooks/pre-commitis created and executable.just install-hooksa second time (idempotency check) - should overwrite cleanly.just pre-commitand confirm all four cargo steps execute in order inside theapicontainer.Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com