Repository navigation
Expand file tree
/
Copy pathlefthook.yml
More file actions
90 lines (79 loc) · 3.06 KB
/
Copy pathlefthook.yml
File metadata and controls
90 lines (79 loc) · 3.06 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
min_version: 2.1.0
# Skip hooks with `git commit --no-verify` or `LEFTHOOK=0 git commit ...`.
# Go-only contributors: `go install github.com/evilmartians/lefthook/v2@v2.1.0 && lefthook install`.
# Frontend/full-stack contributors: `pnpm install` in webui/ plus `lefthook install`.
# Execution model:
# - Top-level jobs (frontend, go) run in parallel — they touch disjoint file sets.
# - Within each group, jobs are piped so format runs before lint/policy checks read the file.
# - stage_fixed re-stages formatter output; lefthook serializes the git index updates.
pre-commit:
parallel: true
skip:
- merge
- rebase
jobs:
- name: frontend
root: "webui/"
group:
piped: true
jobs:
- name: format
glob: "**/*.{ts,tsx,css,scss,json,md,html,yml,yaml}"
exclude:
- "webui/CLAUDE.md"
- "webui/e2e/CLAUDE.md"
run: pnpm exec prettier --write --cache --ignore-unknown {staged_files}
stage_fixed: true
fail_text: "Prettier failed. Fix the errors above or bypass with --no-verify."
- name: lint
glob: "**/*.{ts,tsx}"
run: pnpm exec eslint --cache --no-error-on-unmatched-pattern {staged_files}
fail_text: "ESLint failed. Fix errors above, or run `pnpm --dir webui run lint` locally."
- name: go
group:
piped: true
jobs:
- name: format
glob: "**/*.go"
run: golangci-lint fmt {staged_files}
stage_fixed: true
fail_text: "golangci-lint fmt failed. See output above."
- name: literalpolicy
glob: "**/*.go"
run: go run ./cmd/literalpolicy
fail_text: "Composite literal layout failed. Run `make fmt-go`."
- name: logpolicy
glob:
- "internal/*.go"
- "internal/**/*.go"
run: go run ./cmd/logpolicy
fail_text: "Log policy check failed. Review log lines added/changed under internal/."
- name: pathpolicy
glob: "**/*.go"
run: go run ./cmd/pathpolicy
fail_text: "Path policy check failed. Avoid hardcoded OS-rooted local paths in filepath calls."
pre-push:
parallel: true
jobs:
- name: frontend-typecheck
root: "webui/"
glob: "**/*.{ts,tsx}"
run: pnpm run typecheck
fail_text: "TypeScript typecheck failed. Run `pnpm --dir webui run typecheck`."
- name: go-lint
glob: "**/*.go"
run: make lint
fail_text: "Go lint failed. Run `make lint` locally."
commit-msg:
jobs:
- name: commit-message
run: go run ./cmd/commitmsgcheck {1}
fail_text: |
Commit message does not follow Conventional Commits.
Format: <type>(<scope>): <subject> (scope optional)
Types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert
Examples:
feat(config): add YAML loader
fix: correct typo in README
feat!: drop support for Go 1.19
See https://www.conventionalcommits.org/