-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhk.pkl
More file actions
69 lines (62 loc) · 1.63 KB
/
hk.pkl
File metadata and controls
69 lines (62 loc) · 1.63 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
65
66
67
68
69
// Install with `hk install --mise` to ensure local tools are available
amends "package://github.com/jdx/hk/releases/download/v0.8.2/hk@0.8.2#/Config.pkl"
import "package://github.com/jdx/hk/releases/download/v0.8.2/hk@0.8.2#/Builtins.pkl"
min_hk_version = "0.8.2"
local file_list = List("**/*.{gitignore,go,md,pkl,toml,yaml,yml}")
local linters = new Mapping<String, Step> {
["actionlint"] = Builtins.actionlint
["golangci-lint"] {
glob = List("**/*.go")
check = "golangci-lint run"
fix = "golangci-lint run --fix"
}
["go-test"] {
glob = List("**/*.go")
check = "go test ./..."
}
["pkl"] {
glob = List("*.pkl")
check = "pkl eval {{files}} >/dev/null"
}
["toml-sort"] {
glob = List("**/*.toml")
check = "toml-sort --check {{ files }}"
fix = "toml-sort --in-place {{ files }}"
}
}
local commit_msg_checks = new Mapping<String, Step> {
["commitizen"] {
check = "cz check --allow-abort --commit-msg-file={{commit_msg_file}}"
}
}
local pre_push_checks = new Mapping<String, Step> {
["commitizen-branch"] {
check = "cz check --rev-range origin/HEAD..HEAD"
}
}
hooks = new {
["pre-commit"] {
fix = true
stash = "patch-file"
steps = linters
}
["pre-push"] {
steps = new {
...pre_push_checks
...linters
}
}
["commit-msg"] {
steps = commit_msg_checks
}
["fix"] {
fix = true
steps = linters
}
["check"] {
steps = new {
...pre_push_checks
...linters
}
}
}