This repository was archived by the owner on Mar 12, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
103 lines (84 loc) · 2.89 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
103 lines (84 loc) · 2.89 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
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
# Configuration
default_language_version:
golang: 1.23.0
# Only run on commit (not push)
default_stages: [pre-commit]
# Don't stop on first failure
fail_fast: false
repos:
# General file checks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
# Remove trailing whitespace
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
# Ensure files end with a newline
- id: end-of-file-fixer
exclude: ^(vendor/|testdata/)
# Check yaml files
- id: check-yaml
args: [--allow-multiple-documents]
exclude: ^(helm/|k8s/)
# Prevent large files from being committed
- id: check-added-large-files
args: ['--maxkb=1000']
# Check for merge conflicts
- id: check-merge-conflict
# Check json files
- id: check-json
exclude: ^(vendor/|testdata/|\.devcontainer/)
# Detect private keys
- id: detect-private-key
exclude: cmd/license-gen/main.go
# Ensure consistent line endings
- id: mixed-line-ending
args: [--fix=lf]
# Go specific hooks
- repo: https://github.com/dnephin/pre-commit-golang
rev: v0.5.1
hooks:
# Format Go code
- id: go-fmt
# Organize imports
- id: go-imports
args: [-w, -local, proxynd]
# Run go vet
- id: go-vet
# Ensure go.mod is tidy
- id: go-mod-tidy
# Go linting (using our configured golangci-lint)
- repo: local
hooks:
- id: golangci-lint
name: golangci-lint
entry: golangci-lint run --fix --new-from-rev=HEAD~
language: system
types: [go]
pass_filenames: false
# Local custom checks
- repo: local
hooks:
# Check for go.mod replace directives (should not be in production)
- id: go-no-replacement
name: Check for go.mod replacements
entry: bash -c '! grep -q "^replace" go.mod || (echo "go.mod contains replace directives" && exit 1)'
language: system
files: go.mod
# TODO: Mock 생성 설정 정리 후 활성화 (make generate-mocks 사용 권장)
# Ensure generated files are committed
# - id: go-generate
# name: Check go generate
# entry: bash -c 'go generate ./... && git diff --exit-code'
# language: system
# files: \.go$
# pass_filenames: false
# TODO: 구조화된 로깅으로 마이그레이션 후 활성화
# Check for problematic patterns
# - id: check-fmt-print
# name: Check for fmt.Print statements
# entry: bash -c '! grep -rn "fmt\.Print" --include="*.go" . | grep -v "_test\.go" | grep -v "vendor/" || (echo "Found fmt.Print statements (use structured logging instead)" && exit 1)'
# language: system
# pass_filenames: false