Skip to content

Commit 76f1dcf

Browse files
committed
build: properly add hk.pkl + drop branch check
1 parent e889d5a commit 76f1dcf

3 files changed

Lines changed: 52 additions & 5 deletions

File tree

.github/workflows/check-sources.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ jobs:
2727
with:
2828
cache: false
2929

30-
# switch git branches so we don't trip the branch pre-commit check
31-
- name: Switch branches
32-
run: git checkout -b check-source HEAD
33-
3430
- name: ✅ Check that pre-commit is clean
3531
run: |
3632
hk check --all

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ htmlcov/
2424
perf.data*
2525
*.linux-perf.txt
2626
*.speedscope.json
27-
*.pkl
2827
*.zst
2928
*.gz
3029
*.bz2

hk.pkl

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
amends "package://github.com/jdx/hk/releases/download/v1.49.0/hk@1.49.0#/Config.pkl"
2+
import "package://github.com/jdx/hk/releases/download/v1.49.0/hk@1.49.0#/Builtins.pkl"
3+
4+
local linters = new Mapping<String, Step> {
5+
["large-files"] = (Builtins.check_added_large_files) {
6+
exclude = Regex(#"(^uv\.lock|\.ipynb|\.csv)$"#)
7+
}
8+
["end-of-file-fixer"] = Builtins.newlines
9+
["mixed-line-ending"] = Builtins.mixed_line_ending
10+
["trailing-whitespace"] = Builtins.trailing_whitespace
11+
// ["check-merge-conflict"] = Builtins.check_merge_conflict
12+
["check-toml"] = Builtins.taplo
13+
}
14+
15+
local formatters = new Mapping<String, Step> {
16+
["format-rust"] = Builtins.rustfmt
17+
// ["format-toml"] = Builtins.taplo_format
18+
["dprint"] = (Builtins.dprint) {
19+
glob = Regex(#"(.*\.yaml$|.*\.yml$|.*\.toml$|.*\.json$)"#)
20+
}
21+
["license-headers"] {
22+
glob = Regex(#"(.*\.py$|.*\.rs$)"#)
23+
check = "uv run utils/update-headers.py --check-only {{ files }}"
24+
fix = "uv run utils/update-headers.py {{ files }}"
25+
}
26+
["pkl-format"] = Builtins.pkl_format
27+
}
28+
29+
hooks {
30+
["pre-commit"] {
31+
fix = true
32+
stash = "git"
33+
steps {
34+
["commit-branch"] = Builtins.no_commit_to_branch
35+
...linters
36+
...formatters
37+
}
38+
}
39+
["check"] {
40+
steps {
41+
...linters
42+
...formatters
43+
}
44+
}
45+
["fix"] {
46+
fix = true
47+
steps {
48+
...linters
49+
...formatters
50+
}
51+
}
52+
}

0 commit comments

Comments
 (0)