generated from eblume/project-template
infra(prek): add cargo fmt as a pre-commit hook
Some checks failed
Build / validate (pull_request) Failing after 18s
Some checks failed
Build / validate (pull_request) Failing after 18s
Run `cargo fmt --all` in place over the workspace on any staged .rs change, matching the repo's other in-place formatters (ruff-format, stylua, shfmt). Unformatted Rust now fails the commit locally (it reformats + reports "files were modified"), so the fmt-dirty commits that slipped through this session can't recur. CI still enforces `cargo fmt --check` via Dagger as the backstop. Verified: passes clean, catches + fixes a deviation. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
dce3519345
commit
ec522f49ec
2 changed files with 15 additions and 0 deletions
14
prek.toml
14
prek.toml
|
|
@ -83,6 +83,20 @@ repo = "https://github.com/JohnnyMorganz/StyLua"
|
|||
rev = "v2.4.1"
|
||||
hooks = [{ id = "stylua-system" }]
|
||||
|
||||
# Rust formatting - cargo fmt over the whole workspace, in place (like the other
|
||||
# formatters above). Uses the system toolchain; CI also enforces it via
|
||||
# `dagger call check` (cargo fmt --check). Runs whenever a .rs file is staged.
|
||||
[[repos]]
|
||||
repo = "local"
|
||||
|
||||
[[repos.hooks]]
|
||||
id = "cargo-fmt"
|
||||
name = "cargo-fmt"
|
||||
entry = "cargo fmt --all"
|
||||
language = "system"
|
||||
files = '\.rs$'
|
||||
pass_filenames = false
|
||||
|
||||
# GitHub/Forgejo Actions workflow linting
|
||||
[[repos]]
|
||||
repo = "https://github.com/rhysd/actionlint"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue