Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions hk.pkl
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,28 @@ steps {
["trailing_whitespace"] = Hk.trailing_whitespace
["yamlfmt"] = Hk.yamlfmt
}

hooks {
["commit-msg"] {
fix = true
steps {
["change-id"] = Extra.timber_commit_msg
}
}
["pre-commit"] {
fix = true
stage = true
stash = "git"
steps {
// No file filter: scan every staged change, including arbitrary types,
// binary files, deletions, and commits without Go or Markdown changes.
// The git-mode scan only sees text diffs, so staged binary bytes are
// checked out to a temporary directory and scanned explicitly.
["gitleaks"] = (Hk.gitleaks) {
scan = "staged"
check =
"gitleaks git --redact --pre-commit --staged --verbose --no-banner && tmp=$(mktemp -d) || exit $?; trap 'rm -rf \"$tmp\"' EXIT INT TERM; git diff --cached --name-only -z --diff-filter=ACMRT > \"$tmp/list\" || exit $?; git checkout-index -z --stdin --prefix=\"$tmp/tree/\" < \"$tmp/list\" || exit $?; mkdir -p \"$tmp/tree\" || exit $?; gitleaks dir --redact --verbose --no-banner \"$tmp/tree\" || exit $?"
}
}
}
}
Loading