-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
194 lines (176 loc) · 5.42 KB
/
.pre-commit-config.yaml
File metadata and controls
194 lines (176 loc) · 5.42 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# Copyright 2025 The meowg1k Authors
# SPDX-License-Identifier: Apache-2.0
repos:
# ============================================================
# General File Checks
# ============================================================
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
name: Trim trailing whitespace
- id: end-of-file-fixer
name: Fix end of files
- id: check-yaml
name: Check YAML syntax
args: ["--unsafe"]
- id: check-json
name: Check JSON syntax
- id: check-toml
name: Check TOML syntax
- id: check-added-large-files
name: Check for large files
args: ["--maxkb=5000"]
- id: check-case-conflict
name: Check for case conflicts
- id: check-merge-conflict
name: Check for merge conflicts
- id: check-symlinks
name: Check for broken symlinks
- id: mixed-line-ending
name: Fix line endings
args: ["--fix=lf"]
- id: check-executables-have-shebangs
name: Check executable shebangs
- id: check-shebang-scripts-are-executable
name: Check shebang executables
- id: detect-private-key
name: Detect private keys
- id: fix-byte-order-marker
name: Remove UTF-8 BOM
# ============================================================
# Go Language Checks
# ============================================================
- repo: https://github.com/golangci/golangci-lint
rev: v1.62.2
hooks:
- id: golangci-lint
name: golangci-lint (full check)
entry: golangci-lint run --fix
pass_filenames: false
types: [go]
language: system
- repo: local
hooks:
# Go formatting
- id: go-fmt
name: go fmt
entry: go fmt ./...
language: system
files: \.go$
pass_filenames: false
- id: gofumpt
name: gofumpt (stricter gofmt)
entry: bash -c 'gofumpt -l -w .'
language: system
files: \.go$
pass_filenames: false
- id: goimports
name: goimports (organize imports)
entry: bash -c 'goimports -local github.com/retran/meowg1k -w .'
language: system
files: \.go$
pass_filenames: false
# Go dependencies
- id: go-mod-tidy
name: go mod tidy
entry: go mod tidy
language: system
files: (go\.mod|go\.sum)$
pass_filenames: false
- id: go-mod-verify
name: go mod verify
entry: go mod verify
language: system
files: (go\.mod|go\.sum)$
pass_filenames: false
# Go building & testing
- id: go-build
name: go build (check compilation)
entry: go build ./...
language: system
files: \.go$
pass_filenames: false
- id: go-test-short
name: go test (short mode)
entry: go test -short ./...
language: system
files: \.go$
pass_filenames: false
# Go security
- id: go-vet
name: go vet
entry: go vet ./...
language: system
files: \.go$
pass_filenames: false
# ============================================================
# Security Scanning
# ============================================================
- repo: https://github.com/gitleaks/gitleaks
rev: v8.21.2
hooks:
- id: gitleaks
name: Detect hardcoded secrets (gitleaks)
- repo: https://github.com/Yelp/detect-secrets
rev: v1.5.0
hooks:
- id: detect-secrets
name: Detect secrets (detect-secrets)
args: ['--baseline', '.secrets.baseline']
exclude: (go\.sum|package-lock\.json)$
# ============================================================
# Documentation Linting
# ============================================================
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.43.0
hooks:
- id: markdownlint
name: Markdown lint
args: ["--fix", "--config", ".markdownlint.yaml"]
- repo: https://github.com/adrienverge/yamllint
rev: v1.35.1
hooks:
- id: yamllint
name: YAML lint
args: ["-c", ".yamllint.yaml"]
types: [yaml]
# ============================================================
# Commit Message Validation
# ============================================================
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v3.6.0
hooks:
- id: conventional-pre-commit
name: Check commit message format
stages: [commit-msg]
args: []
# ============================================================
# License Header Checking
# ============================================================
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.5
hooks:
- id: insert-license
name: Insert license header (Go)
files: \.go$
args:
- --license-filepath
- LICENSE_HEADER.txt
- --comment-style
- //
- id: insert-license
name: Insert license header (YAML)
files: \.(yaml|yml)$
args:
- --license-filepath
- LICENSE_HEADER.txt
- --comment-style
- "#"
# CI Configuration
ci:
autofix_commit_msg: |
ci(pre-commit): auto fixes from hooks
autofix_prs: true
autoupdate_branch: "dev"
autoupdate_schedule: weekly