1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
skip_output:
- meta
- success
- summary
# most commands are run through 'uv run' to get a consistent version
# this costs ~10ms each
pre-commit:
parallel: true
commands:
rustfmt:
tags: formatter
# cargo assumed to be correct version, controlled via rustup
run: cargo fmt --check
cargo-rdme:
run: cargo rdme --check
taplo:
tags: formatter
glob: "*.toml"
# No need to --force-exclude for taplo
run: taplo format --check -- {staged_files}
env:
# without this, taplo is very verbose
RUST_LOG: warn
typos:
tags: spellcheck
run: uvx typos@1.38 --force-exclude --format=brief -- {staged_files}
cargo-sort:
tags: formatter
glob: "*.toml"
run: cargo sort --grouped --workspace --check . >/dev/null
# takes one parameter - the file with the proposed commit message
# access through lefthook with `{1}`
#
# If this hook fails, a backup of the commit message is saved in .git/
commit-msg:
commands:
typos-commit:
tags: spellcheck
run: typos -- {1}