forked from getkono/spargen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhk.pkl
More file actions
64 lines (62 loc) · 2.26 KB
/
Copy pathhk.pkl
File metadata and controls
64 lines (62 loc) · 2.26 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/// hk — git hooks for spargen. Install with `mise run hooks` (`hk install --mise`), which wraps the
/// hook shim in `mise x` so hk and its tools resolve from `mise.toml`.
///
/// Every step delegates to a task in `mise.toml`. There is no second copy of a gate here, so the
/// hooks, `mise run …` and the documented commands cannot drift apart, and each step runs at the
/// tool versions `mise.toml` pins rather than whatever is on PATH.
///
/// `pre-commit` auto-fixes formatting/lints on the working tree; `pre-push` is the read-only gate
/// (format check, clippy-as-error, tests) plus Conventional Commit validation of the outgoing
/// range. `commit-msg` validates each new commit immediately. Commit-message validation is also
/// enforced in CI on pull requests.
amends "package://github.com/jdx/hk/releases/download/v1.50.0/hk@1.50.0#/Config.pkl"
/// Matches the `amends` package above and the `hk` pin in `mise.toml`.
min_hk_version = "1.50.0"
hooks {
["pre-commit"] {
fix = true
stash = "git"
steps {
// The mise tasks operate on the whole workspace (cargo fmt/clippy have no per-file mode); the
// glob only decides whether the step runs at all.
["fmt"] {
glob = List("*.rs")
check = "mise run fmt-check"
fix = "mise run fmt"
}
["clippy"] {
glob = List("*.rs", "Cargo.toml", "*/Cargo.toml", "Cargo.lock")
exclusive = true
check = "mise run lint"
fix = "mise run lint-fix"
}
}
}
["commit-msg"] {
steps {
// The merge-commit exemption lives in the task; hk supplies the message file.
["convco"] {
check = "mise run --quiet commit-msg < \"{{commit_msg_file}}\""
}
}
}
["pre-push"] {
// Deliberately unglobbed, as before: this is the last gate before code leaves the machine, and
// the suite pins docs/errors.md and the corpus fixtures, so a change touching no Rust at all
// can still break it. A rust-toolchain.toml bump likewise changes what clippy reports.
steps {
["fmt"] {
check = "mise run fmt-check"
}
["clippy"] {
check = "mise run lint"
}
["test"] {
check = "mise run test"
}
["convco"] {
check = "mise run commit-range"
}
}
}
}