1// Git hooks, run by hk (jdx/hk), installed with `mise run hooks:install`. The hk release below must be 2// the one in mise.toml (tools/check-versions.sh checks it). 3amends "package://github.com/jdx/hk/releases/download/v2.5.0/hk@2.5.0#/Config.pkl" 4 5local check_private = new Step { 6 // The whole tree, once; it takes no file list. 7 check = "tools/check-private.sh" 8} 9 10local clippy = new Step { 11 glob = List("crates/**/*.rs", "crates/**/Cargo.toml", "Cargo.lock") 12 // Warnings are shown, not fatal: the tree has some. An error-level lint stops the commit. 13 check = "cargo clippy --workspace" 14} 15 16local web_tests = new Step { 17 glob = List("web/**", "crates/whiskers-pet/**", "crates/whiskers-art/**", "crates/whiskers-judge/**", "crates/whiskers-core/**") 18 check = "cargo test --workspace --manifest-path web/Cargo.toml" 19} 20 21local check_private_message = new Step { 22 // The message of the commit being made: history is public, so it is checked like a file. 23 check = "tools/check-private.sh --message {{commit_msg_file}}" 24} 25 26local check_private_push = new Step { 27 // Every commit that is on no remote yet, not only the tip: files, file names and messages. 28 check = "tools/check-private.sh --push" 29} 30 31hooks { 32 ["commit-msg"] { 33 steps { 34 ["check-private-message"] = check_private_message 35 } 36 } 37 ["pre-commit"] { 38 steps { 39 ["check-private"] = check_private 40 ["clippy"] = clippy 41 } 42 } 43 ["pre-push"] { 44 steps { 45 ["check-private-push"] = check_private_push 46 ["web-tests"] = web_tests 47 } 48 } 49}