-
-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
58 lines (56 loc) · 2.31 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
58 lines (56 loc) · 2.31 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
repos:
# 1. Standard hooks for file hygiene (trailing whitespace, newlines, etc.)
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0 # Latest as of this update (Aug 9, 2025)
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
exclude: ^helm/templates/
- id: check-json
- id: check-added-large-files
# 2. Go-specific hooks for formatting and tidying
# The pre-commit-golang repo has a v1.0.0+ fork which is more actively maintained.
- repo: https://github.com/Bahjat/pre-commit-golang
rev: v1.0.6
hooks:
- id: go-fmt-import # Runs goimports + gofmt on staged .go files
# 2b. Go module tidying (local hook)
- repo: local
hooks:
- id: go-unit-tests
name: make test-race
entry: make test-race
language: system
pass_filenames: false
files: '^((cmd|config|internal)/.*\.go|go\.(mod|sum)|Makefile|\.github/workflows/test\.yml)$'
- id: go-mod-tidy
name: go mod tidy
entry: go mod tidy
language: system
pass_filenames: false
files: '(\.go$|^go\.(mod|sum)$)'
- id: dashboard-js-tests
name: dashboard JavaScript unit tests
entry: make test-dashboard
language: system
pass_filenames: false
files: '^(internal/admin/dashboard/(static/(js|css)/|templates/).*\.(js|css|html)|Makefile|\.github/workflows/test\.yml)$'
- id: perf-hotpath-guard
name: hot-path performance guard (alloc/byte thresholds)
entry: make perf-check
language: system
pass_filenames: false
files: '^(internal/(auditlog|core|providers|server|usage)/.*\.go|tests/perf/.*\.go|Makefile|\.github/workflows/test\.yml)$'
- id: go-lint
name: make lint
entry: make lint
language: system
pass_filenames: false
files: '^(\.golangci\.yml|Makefile|\.github/workflows/test\.yml|.*\.go)$'
- id: mint-validate
name: mint validate
entry: bash -c 'if command -v mint >/dev/null 2>&1; then cd docs && mint validate; else echo "mint not found; skipping docs validation"; fi'
language: system
pass_filenames: false
files: '^(docs/(docs\.json|openapi\.json|.*\.(mdx|md|jsx|tsx|css|svg|png|jpg|jpeg|webp))|\.pre-commit-config\.yaml)$'