chore: add pre-commit hook mirroring check.yml #42

Merged
David merged 3 commits from chore/pre-commit-hook into main 2026-05-10 20:21:37 +02:00
Owner

scripts/pre-commit runs the same cargo fmt --check, clippy, two wasm32 cargo checks (standalone+web and saas+web), full build, and cargo test --lib that .forgejo/workflows/check.yml runs in CI, so drift is caught before push instead of after.

Hook lives in scripts/ so it tracks with the repo. Each contributor opts in once per clone with just install-hooks, which symlinks .git/hooks/pre-commit at scripts/pre-commit. Bypass for a single commit with git commit --no-verify.

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

scripts/pre-commit runs the same `cargo fmt --check`, clippy, two wasm32 cargo checks (standalone+web and saas+web), full build, and `cargo test --lib` that .forgejo/workflows/check.yml runs in CI, so drift is caught before push instead of after. Hook lives in scripts/ so it tracks with the repo. Each contributor opts in once per clone with `just install-hooks`, which symlinks .git/hooks/pre-commit at scripts/pre-commit. Bypass for a single commit with `git commit --no-verify`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
chore: add pre-commit hook mirroring check.yml
Some checks failed
Check / clippy + fmt + tests (pull_request) Failing after 9s
3a63641be5
scripts/pre-commit runs the same `cargo fmt --check`, clippy, two wasm32 cargo checks (standalone+web and saas+web), full build, and `cargo test --lib` that .forgejo/workflows/check.yml runs in CI, so drift is caught before push instead of after.

Hook lives in scripts/ so it tracks with the repo. Each contributor opts in once per clone with `just install-hooks`, which symlinks .git/hooks/pre-commit at scripts/pre-commit. Bypass for a single commit with `git commit --no-verify`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
chore: rewrite pre-commit hook in nushell
Some checks failed
Check / clippy + fmt + tests (pull_request) Failing after 42s
9fe9a2f829
Per the project's shell convention. Earlier draft used bash on a misjudged "portability" trade-off, but the rusty-links justfile already runs nu extensively, so contributors here have nu available.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
chore: run pre-commit checks inside the dev compose container
Some checks failed
Check / clippy + fmt + tests (pull_request) Failing after 16s
Create release / Create release from merged PR (pull_request) Has been skipped
8d32e0ce6a
Pre-commit was running cargo on the host, but development for this project happens entirely inside Docker. Host Rust may not even be installed, and even when it is, host clippy/rustfmt versions can drift from CI's `rust-builder-glibc:v1.0.0-rust1.94-trixie`. Switch each step to `docker compose --file compose.dev.yml run --rm app cargo ...` so the dev container's toolchain (already pinned to the CI image) does the work and the existing named cargo cache + target volumes carry incremental state across runs.

Use `--no-deps` for the fmt/clippy/check/build steps so postgres does not spin up unnecessarily; keep deps live for `cargo test --lib` in case lib tests touch the database.

Bypassing the hook for this commit since chore/pre-commit-hook itself runs into the pre-existing `clippy::items-after-test-module` failure in src/ui/http.rs, which is being fixed in a separate PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
David merged commit 1c8e7cde97 into main 2026-05-10 20:21:37 +02:00
David deleted branch chore/pre-commit-hook 2026-05-10 20:21:37 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
a8n-tools/rusty-links!42
No description provided.