-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhk.pkl
More file actions
103 lines (92 loc) · 3.06 KB
/
hk.pkl
File metadata and controls
103 lines (92 loc) · 3.06 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
// Install with `hk install --mise` to ensure local tools are available
amends "package://github.com/jdx/hk/releases/download/v1.15.6/hk@1.15.6#/Config.pkl"
import "package://github.com/jdx/hk/releases/download/v1.15.6/hk@1.15.6#/Builtins.pkl"
// amends "package://github.com/jdx/hk/releases/download/v1.26.0/hk@1.26.0#/Config.pkl"
// import "package://github.com/jdx/hk/releases/download/v1.26.0/hk@1.26.0#/Builtins.pkl"
min_hk_version = "1.15.6"
exclude = List("**/*.min.js", "**/*.ambr", "**/*.png")
local linters = new Mapping<String, Step> {
["actionlint"] = Builtins.actionlint
["pkl"] {
glob = "*.pkl"
check = "pkl eval {{files}} >/dev/null"
}
// PLANNED: Pending v1.26.0
// ["pkl"] = Builtins.pkl_format
["pch-check-added-large-files"] {
check = "check-added-large-files {{ files }}"
}
["pch-check-merge-conflict"] {
check = "check-merge-conflict {{ files }}"
}
["pch-check-symlinks"] {
check = "check-symlinks {{ files }}"
}
["pch-check-vcs-permalinks"] {
check = "check-vcs-permalinks {{ files }}"
}
["pch-check-yaml"] {
glob = List("**/*.{yml,yaml}")
check = "check-yaml {{ files }}"
}
["pch-end-of-file-fixer"] {
// FYI: without check, these fixers are always run!
check_first = false // FYI: without check_first, these linters request write-locks on all files
fix = "end-of-file-fixer {{ files }}"
}
["pch-mixed-line-ending"] {
check_first = false
fix = "mixed-line-ending {{ files }}"
}
["pch-trailing-whitespace-fixer"] {
check_first = false
fix = "trailing-whitespace-fixer {{ files }}"
}
["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"
}
}
// FYI: there are additional configuration options for batch, workspace_indicator, etc. https://hk.jdx.dev/configuration.html
hooks = new {
["pre-commit"] {
fix = true // automatically modify files with available linter fixes
stash = "git" // stashes unstaged changes while running fix steps
steps = linters
}
["pre-push"] {
steps = new {
// FYI: PRs aren't required for this project
// ["pch-no-commit-to-branch"] {
// run = "no-commit-to-branch --branch=main"
// }
...pre_push_checks
...linters
}
}
["commit-msg"] {
steps = commit_msg_checks
}
// "fix" and "check" are special steps for `hk fix` and `hk check` commands
["fix"] {
fix = true
steps = linters
}
["check"] {
steps = new {
...pre_push_checks
...linters
}
}
}