-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathhk.pkl
More file actions
157 lines (152 loc) · 4.81 KB
/
Copy pathhk.pkl
File metadata and controls
157 lines (152 loc) · 4.81 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
amends "package://github.com/jdx/hk/releases/download/v1.55.0/hk@1.55.0#/Config.pkl"
import "package://github.com/jdx/hk/releases/download/v1.55.0/hk@1.55.0#/Builtins.pkl"
local bash_glob = List("*.sh", "xtasks/**", "scripts/**", "e2e/**")
local bash_exclude = List("*.ps1", "**/*.fish", "*.ts", "*.js", "*.json", "*.bat", "**/.*", "src/assets/bash_zsh_support/**", "e2e/shell/xonsh_script", "tmp/install.sh", "**/*.py", "**/*.xsh")
local linters = new Mapping<String, Step> {
["schema"] {
glob = List("schema/**/*.json")
stdin = "{{ files_list | join(sep='\u{0}') }}"
check = new CommandSpec {
command = "xargs -0 -I {} ajv compile -s {} --spec=draft2020 --strict-types=true --strict-tuples=true"
effect = "read"
}
check_first = false
}
// uses builtin prettier linter config; run via `mise x` so hk picks up
// the mise-pinned prettier rather than whatever happens to be on
// PATH (e.g. a Homebrew prettier), keeping local and CI in sync.
["prettier"] = (Builtins.prettier) {
batch = false
exclude = "vendor/aqua-registry/**"
check = new CommandSpec {
command = "mise x prettier -- prettier --check {{ files }}"
effect = "read"
}
check_list_files = new CommandSpec {
command = "mise x prettier -- prettier --list-different {{ files }}"
effect = "read"
}
fix = new CommandSpec {
command = "mise x prettier -- prettier --write {{ files }}"
effect = "write"
}
depends = List("schema")
}
//["clippy"] = (Builtins.cargo_clippy) {
// check = "cargo clippy --manifest-path {{workspace_indicator}} --all-features -- -Dwarnings"
// fix = "cargo clippy --manifest-path {{workspace_indicator}} --all-features --fix --allow-dirty --allow-staged -- -Dwarnings"
//}
["cargo-fmt"] {
glob = List("**/*.rs")
check = new CommandSpec {
command = "cargo fmt --all -- --check"
effect = "read"
}
fix = new CommandSpec {
command = "cargo fmt --all"
effect = "write"
}
}
["cargo-check"] = (Builtins.cargo_check) {
check = new CommandSpec {
command = "mbx check --all-features"
effect = "write"
}
}
["shellcheck"] = (Builtins.shellcheck) {
match_any = null
glob = bash_glob
exclude = bash_exclude
batch = true
check = new CommandSpec {
command = "shellcheck -x {{ files }}"
effect = "read"
}
}
["shfmt"] = (Builtins.shfmt) {
match_any = null
check_list_files = new CommandSpec {
command = """
files=$(shfmt -l -s {{ files }})
if [ -n "$files" ]; then
echo "$files"
exit 1
fi
"""
effect = "read"
}
fix = new CommandSpec {
command = "shfmt -w -s {{ files }}"
effect = "write"
}
glob = bash_glob
exclude = bash_exclude
}
// uses custom pkl linter config
["pkl"] {
glob = "**/*.pkl"
check = new CommandSpec {
command = "pkl eval {{files}} >/dev/null"
effect = "write"
}
}
// uses taplo for TOML formatting and validation
["taplo"] {
glob = List("**/*.toml")
check = new CommandSpec {
command = "taplo fmt --check {{files}} && taplo check {{files}}"
effect = "read"
}
fix = new CommandSpec {
command = "taplo fmt {{files}} && taplo check {{files}}"
effect = "write"
}
}
// uses lua-language-server to check vfox test plugin Lua files
// excludes embedded-plugins/ which are vendored from external repos
["lua-check"] {
glob = List("crates/vfox/plugins/**/*.lua")
check = new CommandSpec {
command = "lua-language-server --check crates/vfox/plugins/"
effect = "write"
}
}
["stylua"] {
glob = List("crates/vfox/plugins/**/*.lua")
check = new CommandSpec {
command = "stylua --check crates/vfox/plugins/"
effect = "read"
}
fix = new CommandSpec {
command = "stylua crates/vfox/plugins/"
effect = "write"
}
}
["actionlint"] {
glob = List(".github/workflows/*.yml")
check = new CommandSpec {
command = "SHELLCHECK_OPTS='--exclude=SC1090 --exclude=SC2046 --exclude=SC2086 --exclude=SC2129' actionlint"
effect = "read"
}
}
["markdownlint"] {
glob = List("**/*.md")
check = new CommandSpec {
command = "markdownlint {{ files }}"
effect = "read"
}
fix = new CommandSpec {
command = "markdownlint --fix {{ files }}"
effect = "write"
}
}
}
hooks {
["fix"] {
fix = true
steps = linters
}
["check"] {
steps = linters
}
}