-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.golangci.yaml
381 lines (376 loc) · 9.85 KB
/
.golangci.yaml
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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
run:
timeout: 5m
output:
sort-results: true
sort-order:
- linter
- severity
- file
show-stats: true
linters:
disable-all: true
enable:
# - asasalint
# - asciicheck
# - bidichk
- bodyclose
- canonicalheader
# - containedctx
# - contextcheck
- copyloopvar
# - cyclop
# - decorder
# - depguard
# - dogsled
- dupl
- dupword
- durationcheck
# - err113
- errcheck
# - errchkjson
- errname
- errorlint
# - exhaustive
# - exhaustruct
# - exportloopref # govet already reports an error when loop variable is captured by func literal so this linter is not needed.
- fatcontext
- forbidigo
# - forcetypeassert # This check can be enabled through errcheck with check-type-assertions.
- funlen
# - gci
# - ginkgolinter
- gocheckcompilerdirectives
# - gochecknoglobals
# - gochecknoinits
# - gochecksumtype
- gocognit
- goconst
# - gocritic
# - gocyclo
- godot
# - godox
# - gofmt # gofumpt includes formatting rules that are a superset of gofmt.
- gofumpt
- goheader
# - goimports # gci has equivalent/better functionality.
# - gomoddirectives
# - gomodguard
- goprintffuncname
- gosec
- gosimple
- gosmopolitan
- govet
# - grouper
# - importas
- inamedparam
- ineffassign
- interfacebloat
- intrange
- lll
# - loggercheck
# - maintidx
# - makezero
- mirror
- misspell
# - mnd
- musttag
- nakedret
# - nestif
- nilerr
- nilnil
# - nlreturn
- noctx
- nolintlint
# - nonamedreturns
- nosprintfhostport
# - paralleltest
- perfsprint
- prealloc
- predeclared
# - promlinter
# - protogetter
- reassign
- revive
# - rowserrcheck
- sloglint
# - spancheck
# - sqlclosecheck
- staticcheck
- stylecheck
# - tagalign
- tagliatelle
- tenv
- testableexamples
- testifylint
# - testpackage
- thelper
# - tparallel
- typecheck
- unconvert
# - unparam
- unused
- usestdlibvars
- varnamelen
# - wastedassign
# - whitespace
- wrapcheck
- wsl
# - zerologlint
issues:
exclude-rules:
- linters:
- lll
source: "^//go:generate "
- path: '(.+)_test\.go'
text: "copies lock"
- path: '(.+)_test\.go'
linters:
- funlen
- varnamelen
- wsl
- dupl
severity:
default-severity: "@linter"
case-sensitive: false
linters-settings:
errcheck:
check-blank: true
check-type-assertions: true
misspell:
locale: US # US is common spelling.
tagliatelle:
case:
rules:
json: snake
yaml: snake
varnamelen:
ignore-names:
- err
- wg
- tt
- id
- ok
- mu
revive:
enable-all-rules: true
confidence: 0.8
ignore-generated-header: false
rules:
- name: context-keys-type # Covered by staticcheck SA1029.
disabled: true
- name: time-naming # Covered by stylecheck ST1011.
disabled: true
- name: errorf # Covered by gosimple S1028.
disabled: true
- name: dot-imports # Covered by stylecheck ST1001.
disabled: true
- name: error-return # Covered by stylecheck ST1008.
disabled: true
- name: error-strings # Covered by stylecheck ST1005.
disabled: true
- name: error-naming # Covered by stylecheck ST1012.
disabled: true
- name: var-naming # Covered by stylecheck ST1003.
disabled: true
- name: package-comments
disabled: true
- name: range # Covered by gofumpt.
disabled: true
- name: receiver-naming # Covered by stylecheck ST1006.
disabled: true
- name: cyclomatic # Covered by gocognit.
disabled: true
- name: max-public-structs
disabled: true
- name: file-header
disabled: true
- name: empty-block # Covered by staticcheck SA9003.
disabled: true
- name: confusing-results # Covered more comprehensively by gocritic unnamedResult.
disabled: true
- name: unreachable-code # Covered by govet unreachable check.
disabled: true
- name: add-constant # Covered by goconst.
disabled: true
- name: flag-parameter
disabled: true
- name: unnecessary-stmt # Covered by gosimple S1023.
disabled: true
- name: bool-literal-in-expr # Covered by gosimple S1002.
disabled: true
- name: imports-blocklist
disabled: true
- name: range-val-in-closure # Covered by govet loopclosure check.
disabled: true
- name: waitgroup-by-value # Covered by govet copylocks check.
disabled: true
- name: atomic # Covered by govet atomic check.
disabled: true
- name: empty-lines # Covered by gofumpt.
disabled: true
- name: line-length-limit # Covered by lll.
disabled: true
- name: duplicated-imports # Covered by stylecheck ST1019.
disabled: true
- name: unhandled-error # Covered by errcheck.
disabled: true
- name: cognitive-complexity # Covered by gocognit.
disabled: true
- name: string-of-int # Covered by govet stringintconv check.
disabled: true
- name: function-length
disabled: true
- name: useless-break # Covered by staticcheck SA4011.
disabled: true
- name: banned-characters
disabled: true
- name: enforce-repeated-arg-type-style # Covered by govet.
disabled: true
- name: max-control-nesting # Covered by cocognit.
disabled: true
- name: argument-limit
arguments:
- 5
- name: function-result-limit
arguments:
- 3
gocyclo:
min-complexity: 15
goimports:
local-prefixes: github.com/joshuar/go-hass-agent
dupl:
threshold: 100
funlen:
lines: 100
statements: 50
gci:
sections:
- blank # Blank section: contains all blank imports.
- dot # Dot section: contains all dot imports.
- standard # Standard section: captures all standard packages.
- default # Default section: contains all imports that could not be matched to another section type.
- alias # Alias section: contains all alias imports.
- prefix(github.com/joshuar) # Custom section: groups all imports with the specified Prefix.
skip-generated: true
custom-order: true
gocognit:
min-complexity: 20
goconst:
min-len: 2
min-occurrences: 3
ignore-tests: true
gocritic:
enable-all: true
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- appendAssign
- badRegexp
- badSorting
- builtinShadowDecl
- codegenComment
- dupBranchBody
- dupSubExpr
- dynamicFmtString
- emptyDecl
- evalOrder
- externalErrorReassign
- flagDeref
- flagName
- nilValReturn
- regexpPattern
- sortSlice
- sqlQuery
- syncMapLoadAndDelete
- uncheckedInlineErr
- unnecessaryDefer
- builtinShadow
- captLocal
- commentFormatting
- defaultCaseOrder
- deferUnlambda
- docStub
- dupImport
- exposedSyncMutex
- hexLiteral
- httpNoBody
- importShadow
- initClause
- methodExprCall
- newDeref
- octalLiteral
- paramTypeCombine
- regexpMust
- ruleguard
- singleCaseSwitch
- sloppyLen
- stringConcatSimplify
- switchTrue
- timeExprSimplify
- tooManyResultsChecker
- typeAssertChain
- typeDefFirst
- typeSwitchVar
- typeUnparen
- unlabelStmt
- unlambda
- unnecessaryBlock
- valSwap
- whyNoLint
- yodaStyleExpr
- appendCombine
- equalFold
- indexAlloc
- preferDecodeRune
- preferWriteByte
- rangeExprCopy
- sliceClear
govet:
enable-all: true
disable:
- asmdecl # (not needed) reports mismatches between assembly files and Go declarations.
- assign # (dupl staticcheck) detects useless assignments.
- cgocall # (not needed) detects some violations of the cgo pointer passing rules.
- fieldalignment # (not needed) detects structs that would use less memory if their fields were sorted.
- findcall # (not needed) serves as a trivial example and test of the Analysis API.
- framepointer # (not needed) reports assembly code that clobbers the frame pointer before saving it.
- structtag # (dupl revive struct-tag) defines an Analyzer that checks struct field tags are well formed.
lll:
line-length: 140
nolintlint:
allow-unused: false # report any unused nolint directives
require-explanation: false # don't require an explanation for nolint directives
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
gosec:
excludes:
- G204
perfsprint:
errorf: false
strconcat: false
sloglint:
# Enforce not mixing key-value pairs and attributes.
# Default: true
no-mixed-args: false
# Enforce using key-value pairs only (overrides no-mixed-args, incompatible with attr-only).
# Default: false
kv-only: false
# Enforce using attributes only (overrides no-mixed-args, incompatible with kv-only).
# Default: false
attr-only: true
# Enforce using static values for log messages.
# Default: false
static-msg: true
# Enforce using constants instead of raw keys.
# Default: false
no-raw-keys: false
# Enforce a single key naming convention.
# Values: snake, kebab, camel, pascal
# Default: ""
key-naming-case: snake
# Enforce putting arguments on separate lines.
# Default: false
args-on-sep-lines: true