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
54 changes: 2 additions & 52 deletions lefthook.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Canonical lefthook config for hawk-eco Go repos.
# Source of truth: .shared-templates/lefthook.yml.tmpl
# lefthook config for hawk-sdk-typescript (TypeScript / npm).
# Source of truth for Go repos: .shared-templates/lefthook.yml.tmpl
#
# Install lefthook:
# brew install lefthook (macOS)
# go install github.com/evilmartians/lefthook@latest
# npm install -g lefthook (cross-platform)
#
# Activate hooks in this repo (one time):
Expand All @@ -19,34 +18,6 @@ pre-commit:
parallel: true
commands:

fmt:
glob: "*.go"
run: |
if ! command -v gofumpt >/dev/null 2>&1; then
echo "lefthook: gofumpt not installed (go install mvdan.cc/gofumpt@latest)"; exit 1
fi
gofumpt -w {staged_files}
stage_fixed: true

imports:
glob: "*.go"
run: |
if ! command -v goimports >/dev/null 2>&1; then
echo "lefthook: goimports not installed (go install golang.org/x/tools/cmd/goimports@latest)"; exit 1
fi
goimports -w {staged_files}
stage_fixed: true

lint:
glob: "*.go"
run: |
if ! command -v golangci-lint >/dev/null 2>&1; then
echo "lefthook: golangci-lint not installed — skipping (install: https://golangci-lint.run/usage/install/)"
exit 0
fi
golangci-lint run --new-from-rev=HEAD~1 --fix {staged_files}
stage_fixed: true

yaml-lint:
glob: "*.{yml,yaml}"
run: |
Expand All @@ -69,32 +40,11 @@ pre-commit:
exit 1
fi

# ---------------------------------------------------------------------------
# pre-push — heavier checks, runs only on push (not every commit).
# ---------------------------------------------------------------------------
pre-push:
commands:

test:
run: go test ./... -count=1 -timeout=60s

vet:
run: go vet ./...

govulncheck:
run: |
if ! command -v govulncheck >/dev/null 2>&1; then
echo "lefthook: govulncheck not installed — skipping"
exit 0
fi
govulncheck ./...

# ---------------------------------------------------------------------------
# commit-msg — validate Conventional Commits and strip AI co-author trailers.
# ---------------------------------------------------------------------------
commit-msg:
commands:

conventional-commit:
run: |
msg=$(head -n1 "{1}")
Expand Down
Loading