-
Notifications
You must be signed in to change notification settings - Fork 702
Expand file tree
/
Copy pathhk.pkl
More file actions
56 lines (51 loc) · 2.02 KB
/
Copy pathhk.pkl
File metadata and controls
56 lines (51 loc) · 2.02 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
// Install with `hk install --mise` to ensure local tools are available
amends "package://github.com/jdx/hk/releases/download/v1.49.0/hk@1.49.0#/Config.pkl"
import "package://github.com/jdx/hk/releases/download/v1.49.0/hk@1.49.0#/Builtins.pkl"
min_hk_version = "1.49.0"
// `ruff` builtin steps invoke the global `ruff` binary. Run it via `uv run`
// instead so hk uses the version pinned in pyproject.toml, matching
// `make lint`/`make fix` and the `uv run pyright` step below.
local linters = new Mapping<String, Step> {
["ruff"] {
glob = List("**/*.py")
check = "uv run ruff check {{files}}"
fix = "uv run ruff check --fix {{files}}"
}
["ruff-format"] {
glob = List("**/*.py")
check_diff = "uv run ruff format --diff {{files}}"
fix = "uv run ruff format {{files}}"
}
["pyright"] {
glob = "*.py"
check = "uv run pyright"
}
["check-added-large-files"] = Builtins.check_added_large_files
["check-merge-conflict"] = Builtins.check_merge_conflict
["check-symlinks"] = Builtins.check_symlinks
["detect-private-key"] = Builtins.detect_private_key
// tests/ fixtures are raw output from real tools/libraries and preserve
// their original line endings and whitespace on purpose; don't "fix" them
["mixed-line-ending"] = (Builtins.mixed_line_ending) { exclude = List("tests/**") }
["trailing-whitespace"] = (Builtins.trailing_whitespace) { exclude = List("tests/**") }
["python-check-ast"] = Builtins.python_check_ast
["python-debug-statements"] = Builtins.python_debug_statements
}
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 = linters
}
// "fix" and "check" are special steps for `hk fix` and `hk check` commands
["fix"] {
fix = true
steps = linters
}
["check"] {
steps = linters
}
}