Repository navigation
Expand file tree
/
Copy pathhk.pkl
More file actions
77 lines (74 loc) · 2.31 KB
/
Copy pathhk.pkl
File metadata and controls
77 lines (74 loc) · 2.31 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
// Хуки ставит `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"
// Быстрые проверки идут на каждый коммит. Сеть нужна только lychee, поэтому
// ссылки проверяются в check и перед пушем.
local fast = new Mapping<String, Step> {
["ruff-format"] {
glob = List("**/*.py")
check = "uv run ruff format --check {{files}}"
fix = "uv run ruff format {{files}}"
}
["ruff"] {
glob = List("**/*.py")
check = "uv run ruff check {{files}}"
fix = "uv run ruff check --fix {{files}}"
}
["ty"] {
glob = List("**/*.py")
check = "uv run ty check"
}
["deptry"] {
glob = List("**/*.py", "pyproject.toml")
check = "uv run deptry ."
}
["hadolint"] {
glob = List("Dockerfile*")
check = "hadolint {{files}}"
}
["shellcheck"] {
glob = List("**/*.sh")
check = "shellcheck {{files}}"
}
["sqruff"] {
glob = List("**/*.sql")
check = "sqruff lint {{files}}"
fix = "sqruff fix {{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, поэтому заголовок коммита проверяется
// до записи. В CI тот же commitlint гоняется по диапазону пуша.
["commit-msg"] {
steps {
["commitlint"] {
check = "commitlint --edit {{commit_msg_file}}"
}
}
}
["pre-push"] {
steps = all
}
["check"] { steps = all }
["fix"] {
fix = true
steps = all
}
}