forked from mcuadros/ofelia
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy path.golangci.yml
More file actions
264 lines (264 loc) · 6.83 KB
/
Copy path.golangci.yml
File metadata and controls
264 lines (264 loc) · 6.83 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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
version: "2"
run:
tests: true
# Without these, every linter skips the files behind //go:build integration
# and //go:build e2e — the whole e2e suite and the Docker integration
# adapters were outside static analysis entirely. "unix" is not listed: it is
# a GOOS-derived release tag, already satisfied where those files compile,
# and forcing it would drag unix-only syscalls into the Windows build.
build-tags:
- integration
- e2e
linters:
default: none
enable:
- asciicheck
- bodyclose
- containedctx
- contextcheck
- copyloopvar
- depguard
- dupl
- dupword
- durationcheck
- err113
- errcheck
- errname
- errorlint
- exhaustive
- fatcontext
- forbidigo
- goconst
- gocritic
- gocyclo
- govet
- ineffassign
- intrange
- misspell
- nilerr
- nilnil
- noctx
- nolintlint
- nosprintfhostport
- paralleltest
- prealloc
- predeclared
- revive
- staticcheck
- tagliatelle
- testifylint
- tparallel
- unconvert
- unparam
- unused
- usestdlibvars
- wrapcheck
settings:
depguard:
rules:
main:
deny:
- pkg: github.com/sirupsen/logrus
desc: replaced by stdlib log/slog
forbidigo:
forbid:
- pattern: ^fmt\.Print.*$
goconst:
min-occurrences: 6
gocyclo:
min-complexity: 15
misspell:
locale: US
revive:
rules:
- name: blank-imports
disabled: true
- name: package-comments
- name: var-naming
- name: exported
- name: if-return
- name: early-return
- name: line-length-limit
arguments:
- 140
- name: import-shadowing
- name: time-naming
- name: increment-decrement
wrapcheck:
ignore-sig-regexps:
- errors\.New\(
- \*github\.com/netresearch/ofelia/core\.Context\)\.Next\(
staticcheck:
# Explicit selection instead of the blanket `text: "QF"` exclusion this
# replaces: that regex matched every QF#### check by message text, and
# also silently swallowed an ST1018 finding about invisible Unicode in a
# mail template. QF1008 (redundant embedded-field selector) is the one
# check excluded on purpose — it is pure style and fires widely here.
checks:
- all
- -QF1008
exclusions:
generated: lax
presets:
- common-false-positives
- legacy
- std-error-handling
rules:
# Test files have relaxed linting for practical reasons
- linters:
- gocyclo
- revive
- wrapcheck
- goconst
- nilnil
- err113
- errcheck
- dupl
- errorlint
- gocritic
- predeclared
- staticcheck
- unparam
path: _test\.go
# User-facing validation errors need dynamic context for helpful messages
- linters:
- err113
path: cli/(init|hashpw|daemon|doctor|config_webhook|docker_config_handler)\.go
- linters:
- err113
path: middlewares/(preset|webhook|sanitize).*\.go
- linters:
- err113
path: config/(command_validator|sanitizer)\.go
- linters:
- err113
path: web/server\.go
# Empty branches in test code - often used for pattern matching
- linters:
- staticcheck
path: _test\.go
text: "SA9003"
- linters:
- govet
path: "_test"
text: "buildtag:"
- linters:
- nolintlint
path: core/common\.go
text: nolint:exhaustive
- linters:
- tagliatelle
path: middlewares/slack\.go
# Docker SDK deprecated types - will update when SDK breaks
- linters:
- staticcheck
path: core/adapters/docker/convert_test\.go
text: "SA1019:"
- linters:
- noctx
path: cli/daemon\.go
# Test files don't need context propagation
- linters:
- noctx
path: _test\.go
# Non-parallel tests - intentionally modify global state
- linters:
- paralleltest
- tparallel
path: cli/daemon_boot_test\.go
- linters:
- paralleltest
- tparallel
path: cli/config_initialize_test\.go
- linters:
- paralleltest
- tparallel
path: middlewares/webhook_test\.go
text: "TestWebhook_SendsRequest|TestWebhook_Retry"
- linters:
- paralleltest
- tparallel
path: middlewares/webhook_security_test\.go
text: "TestSetGlobalSecurityConfig"
# Benchmark tests don't need t.Parallel()
- linters:
- paralleltest
- tparallel
path: _benchmark_test\.go
# Integration tests often share state; constructors don't need context
- linters:
- paralleltest
- tparallel
- contextcheck
path: integration_test\.go
# Mutation tests - generated structure, TODO: add t.Parallel() later
- linters:
- paralleltest
- tparallel
path: _mutation_test\.go
# Core tests - TODO: add t.Parallel() incrementally
- linters:
- paralleltest
- tparallel
path: core/.*_test\.go
# CLI tests - many are lifecycle/integration tests
- linters:
- paralleltest
- tparallel
path: cli/.*_test\.go
# Config tests - TODO: add t.Parallel() incrementally
- linters:
- paralleltest
- tparallel
path: config/.*_test\.go
# Web tests - TODO: add t.Parallel() incrementally
- linters:
- paralleltest
- tparallel
path: web/.*_test\.go
# Metrics tests - TODO: add t.Parallel() incrementally
- linters:
- paralleltest
- tparallel
path: metrics/.*_test\.go
# metrics package name is intentional; it does not shadow a top-level stdlib package
- linters:
- revive
path: metrics/
text: "var-naming"
# Middlewares tests - TODO: add t.Parallel() incrementally
- linters:
- paralleltest
- tparallel
path: middlewares/.*_test\.go
# E2e tests manage shared scheduler state
- linters:
- paralleltest
- tparallel
path: e2e/.*_test\.go
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gci
- gofmt
- gofumpt
- goimports
settings:
gci:
sections:
- standard
- default
- prefix(github.com/netresearch/ofelia)
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
issues:
max-issues-per-linter: 0
max-same-issues: 0
uniq-by-line: false