-
Notifications
You must be signed in to change notification settings - Fork 0
/
.golangci.yml
267 lines (265 loc) · 6.93 KB
/
.golangci.yml
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
265
266
linters:
enable-all: true
disable:
- contextcheck # Check whether the function uses a non-inherited context aka context.Background()
- depguard # not needed, does the same as gomodguard
- execinquery # sql linter, no need
- exhaustruct # very annoying, checks if all struct fields are filled
- ginkgolinter # not used libs
- godot # nervig für quasi keinen impact
- gofumpt # we don't use gofumpt
- goheader # unused
- lll # should be disabled in CI, as this is cosmetic only
- nakedret # no need
- rowserrcheck # disabled because sql
- sqlclosecheck # disabled because of generics
- tagliatelle # requires ID instead of Id in jsonTags, which is annoying for our old structs
- perfsprint
linters-settings:
cyclop:
max-complexity: 20
package-average: 10.0
skip-tests: true
dupl:
threshold: 250
errcheck:
# Report about not checking of errors in type assertions: `a := b.(MyStruct)`.
# Such cases aren't reported by default.
# Default: false
check-type-assertions: true
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`.
# Such cases aren't reported by default.
# Default: false
check-blank: true
errchkjson:
report-no-exported: true
exhaustive:
default-signifies-exhaustive: true
forbidigo:
forbid:
- ^(fmt\.Print(|f|ln)|print|println)$
- 'http\.Default(Client|Transport)'
funlen:
lines: 100 # default 60
statements: 40
gocognit:
min-complexity: 20
goconst:
min-occurences: 3
gocyclo:
min-complexity: 20
godot:
exclude:
- "^fixme:"
- "^todo:"
gofmt:
rewrite-rules:
- pattern: 'interface{}'
replacement: 'any'
- pattern: 'a[b:len(a)]'
replacement: 'a[b:]'
- pattern: 'a[0:b]'
replacement: 'a[:b]'
mnd:
# List of function patterns to exclude from analysis.
# Values always ignored: `time.Date`,
# `strconv.FormatInt`, `strconv.FormatUint`, `strconv.FormatFloat`,
# `strconv.ParseInt`, `strconv.ParseUint`, `strconv.ParseFloat`.
# Default: []
ignored-functions:
- os.Chmod
- os.Mkdir
- os.MkdirAll
- os.OpenFile
- os.WriteFile
- prometheus.ExponentialBuckets
- prometheus.ExponentialBucketsRange
- prometheus.LinearBuckets
gomodguard:
blocked:
modules:
- github.com/golang/protobuf:
recommendations:
- google.golang.org/protobuf
reason: "see https://developers.google.com/protocol-buffers/docs/reference/go/faq#modules"
- github.com/satori/go.uuid:
recommendations:
- github.com/google/uuid
reason: "we only want to use the google uuid lib for consistency"
- github.com/gofrs/uuid:
recommendations:
- github.com/google/uuid
reason: "we only want to use the google uuid lib for consistency"
- github.com/twinj/uuid:
recommendations:
- github.com/google/uuid
reason: "we only want to use the google uuid lib for consistency"
- github.com/Clarilab/slacklogger:
recommendations:
- github.com/Clarilab/slacklogger/v2
reason: "we want to update this dependency"
version:
- github.com/savsgio/atreugo/v11:
version: ">11.9.9"
reason: "introduced breaking changes"
govet:
enable-all: true
disable: # those are pretty noisy for no real benefit
- shadow
- fieldalignment
- loopclosure
grouper:
import-require-single-import: true
import-require-grouping: true
lll:
line-length: 160
nolintlint:
allow-no-explanation: [ funlen, lll ]
require-explanation: true
require-specific: true
nonamedreturns:
report-error-in-defer: true
predeclared:
q: true
revive:
enable-all-rules: true
rules:
# Provided by mnd linter
- name: add-constant
disabled: true
- name: argument-limit
disabled: true
# Provided by bidichk
- name: banned-characters
disabled: true
- name: bare-return
disabled: true
- name: cognitive-complexity
disabled: true
- name: confusing-results
disabled: true
- name: cyclomatic
disabled: true
- name: early-return
severity: warning
disabled: true
- name: exported
disabled: true
- name: file-header
disabled: true
- name: function-result-limit
disabled: true
- name: function-length
disabled: true
- name: line-length-limit
disabled: true
- name: max-public-structs
disabled: true
- name: modifies-parameter
disabled: true
- name: nested-structs
disabled: true
- name: package-comments
disabled: true
stylecheck:
checks:
- all
- -ST1000
- -ST1020
- -ST1021
- -ST1022
tagalign:
align: false
order:
- json
- bson
- validate
varnamelen:
min-name-length: 2
ignore-names:
- "i" # loop variable
- "j" # loop variable
- "k" # loop variable
ignore-decls:
- c echo.Context
- t testing.T
- T any
- m map[string]int
wrapcheck:
# An array of strings that specify globs of packages to ignore.
# Default: []
ignorePackageGlobs:
- github.com/savsgio/atreugo/*
wsl:
# Allow declarations (var) to be cuddled.
allow-cuddle-declarations: true
issues:
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
max-issues-per-linter: 0
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
max-same-issues: 0
exclude-rules:
- source: "^//\\s*go:generate\\s"
linters:
- lll
- source: "(noinspection|TODO)"
linters:
- godot
- source: "//noinspection"
linters:
- gocritic
- source: "jsoniter"
linters:
- gochecknoglobals
- path: "_test\\.go"
linters:
- bodyclose
- containedctx
- cyclop
- dupl
- errcheck
- funlen
- goconst
- gocyclo
- mnd
- gosec
- noctx
- wrapcheck
output:
sort-results: true
run:
exclude-dirs:
- cmd
- config
# tests: false
timeout: 3m
severity:
default-severity: warning
rules:
- linters:
- asciicheck
- bidichk
- containedctx
- durationcheck
- errchkjson
- errorlint
- exportloopref
- gocheckcompilerdirectives
- gochecknoinits
- goerr113
- gosmopolitan
- ineffassign
- loggercheck
- makezero
- unused
- unparam
severity: error
- linters:
- dupword
- gci
- goconst
- godot
- gofmt
- goimports
- nakedret
severity: info