forked from awslabs/mountpoint-s3-csi-driver
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
103 lines (97 loc) · 3.76 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
103 lines (97 loc) · 3.76 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
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0 # Latest stable version
hooks:
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- id: check-yaml
args: [--allow-multiple-documents, --unsafe]
# Exclude Helm charts templates
exclude: ^charts/.*/templates/.*\.yaml$
- id: end-of-file-fixer
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1 # Latest stable version as of January 2025
hooks:
- id: codespell
args: ["--skip=*.sum,*.mod", "--ignore-words-list=shs"]
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.45.0
hooks:
- id: markdownlint
args: [--config, .markdownlint.yaml, --fix]
types: [markdown]
- repo: https://github.com/lycheeverse/lychee
rev: lychee-v0.18.1 # Latest stable version
hooks:
- id: lychee
args: [--config, .lychee.toml]
- repo: local
hooks:
# golangci-lint with Linux build environment to match CI
# Uses .golangci.yaml configuration automatically
# GOOS=linux ensures we analyze the same files as CI (including Linux-specific files)
# like pkg/system/pts_test.go (which has //go:build linux constraint)
#
# To install golangci-lint locally (required for this hook):
# curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.1.6
# Or on macOS: brew install golangci-lint
# Or with Go: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v2.1.6
- id: golangci-lint
name: golangci-lint
entry: bash -c 'GOOS=linux golangci-lint run --config .golangci.yaml'
language: system
files: \.go$
pass_filenames: false
# Go formatting tools (gofmt, goimports, gofumpt)
# These run before linting to ensure code is properly formatted
# Matches CI formatting checks exactly to prevent CI failures
#
# REQUIRED: Install formatting tools locally (run once):
# go install golang.org/x/tools/cmd/goimports@latest # Organizes imports
# go install mvdan.cc/gofumpt@latest # Stricter gofmt
# gofmt comes with Go by default # Basic formatting
#
# To fix formatting issues manually:
# gofmt -w . # Fix basic formatting
# goimports -w . # Fix imports and formatting
# gofumpt -w . # Apply strict formatting rules
- id: go-fmt-imports-fumpt
name: go formatting (gofmt, goimports, gofumpt)
entry: |
bash -c '
echo "🔧 Running Go formatters...";
if [ -n "$(gofmt -l .)" ]; then
echo "❌ gofmt issues found:";
gofmt -l .;
echo "Run: gofmt -w .";
exit 1;
fi;
if [ -n "$(goimports -l .)" ]; then
echo "❌ goimports issues found:";
goimports -l .;
echo "Run: goimports -w .";
exit 1;
fi;
if [ -n "$(gofumpt -l .)" ]; then
echo "❌ gofumpt issues found:";
gofumpt -l .;
echo "Run: gofumpt -w .";
exit 1;
fi;
echo "✅ All Go formatting checks passed!";
'
language: system
files: \.go$
pass_filenames: false
- id: helm-lint
name: helm lint
entry: helm lint charts/scality-mountpoint-s3-csi-driver
language: system
files: ^charts/
pass_filenames: false
- id: mkdocs-build
name: mkdocs build
entry: bash -c 'source .venv/bin/activate 2>/dev/null || true; mkdocs build --strict'
language: system
files: ^(mkdocs\.yml|docs/.*)$
pass_filenames: false