Repository navigation
Expand file tree
/
Copy pathhk.pkl
More file actions
68 lines (65 loc) · 2.27 KB
/
Copy pathhk.pkl
File metadata and controls
68 lines (65 loc) · 2.27 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
// Хуки ставит `hk install`: на git 2.54+ это записи hook.* в .git/config,
// общий core.hooksPath дерева кита они не трогают.
amends "package://github.com/jdx/hk/releases/download/v2.8.1/hk@2.8.1#/Config.pkl"
import "package://github.com/jdx/hk/releases/download/v2.8.1/hk@2.8.1#/Builtins.pkl"
// Быстрые проверки идут на каждый коммит. Сеть и долгие шаги вынесены в all:
// их гоняют check, pre-push и CI.
local fast = new Mapping<String, Step> {
["format"] {
glob = List("**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs")
check = "pnpm exec oxfmt --check --no-error-on-unmatched-pattern {{files}}"
fix = "pnpm exec oxfmt --no-error-on-unmatched-pattern {{files}}"
}
["lint"] {
glob = List("**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs")
check = "pnpm exec oxlint {{files}}"
}
["tflint"] {
glob = List("**/*.tf")
check = "tflint --recursive --config \"$(pwd)/.tflint.hcl\""
}
["hadolint"] {
glob = List("**/Dockerfile*")
check = "hadolint {{files}}"
}
["shellcheck"] {
glob = List("**/*.sh")
check = "shellcheck {{files}}"
}
["rumdl"] = Builtins.rumdl
["typos"] = Builtins.typos
["jactionlint"] = Builtins.jactionlint
}
local all = (fast) {
["lychee"] {
glob = List("**/*.md")
check = "lychee --config lychee.toml --no-progress {{files}}"
}
}
hooks {
// stash выключен: на время хука он откатывает непроиндексированные файлы
// рабочего дерева, в том числе чужие правки параллельной сессии.
["pre-commit"] {
fix = true
stash = "none"
steps = fast
}
// История читается release-please, а коммиты идут прямо в main, поэтому
// заголовок проверяется до записи. В CI тот же commitlint гоняется по
// диапазону пуша.
["commit-msg"] {
steps {
["commitlint"] {
check = "commitlint --edit {{commit_msg_file}}"
}
}
}
["pre-push"] {
steps = all
}
["check"] { steps = all }
["fix"] {
fix = true
steps = all
}
}