jevhooks.git / hk.pkl
hk.pkl33 lines · 914 B · raw
1// Git hooks, run by hk (jdx/hk), installed with `mise run hooks:install`. The hk release below must be
2// the one in mise.toml (tools/check-versions.sh checks it).
3amends "package://github.com/jdx/hk/releases/download/v2.5.0/hk@2.5.0#/Config.pkl"
4
5local check_versions = new Step {
6  // The whole tree, once; it takes no file list.
7  check = "tools/check-versions.sh"
8}
9
10local clippy = new Step {
11  glob = List("crates/**/*.rs", "crates/**/Cargo.toml", "Cargo.toml", "Cargo.lock")
12  // Warnings are shown, not fatal. An error-level lint stops the commit.
13  check = "cargo clippy --workspace"
14}
15
16local tests = new Step {
17  glob = List("crates/**", "Cargo.toml", "Cargo.lock", "third-party/**")
18  check = "cargo test --workspace"
19}
20
21hooks {
22  ["pre-commit"] {
23    steps {
24      ["check-versions"] = check_versions
25      ["clippy"] = clippy
26    }
27  }
28  ["pre-push"] {
29    steps {
30      ["tests"] = tests
31    }
32  }
33}