/
.golangci.yml
231 lines (221 loc) · 5.05 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
run:
tests: true
skip-dirs:
- bin
skip-files:
- ".*/generated.go"
## golang-ci already recognizes autogenerated files automatically.
# skip-files:
# - generated
skip-dirs-use-default: true
linters-settings:
# errcheck:
# ignore: fmt:.*,[rR]ead|[wW]rite|[cC]lose,io:Copy
misspell:
ignore-words:
- empiricaly
gocritic:
enabled-checks:
- appendAssign
- argOrder
- badCall
- badCond
- badLock
- badRegexp
- builtinShadowDecl
- caseOrder
- codegenComment
- commentedOutCode
- deprecatedComment
- dupArg
- dupBranchBody
- dupCase
- dupSubExpr
- evalOrder
- exitAfterDefer
- filepathJoin
- flagDeref
- flagName
- mapKey
- nilValReturn
- octalLiteral
- offBy1
- regexpPattern
- sloppyReassign
- sloppyTypeAssert
- sortSlice
- sqlQuery
- truncateCmp
- unnecessaryDefer
- weakCond
- assignOp
- boolExprSimplify
- builtinShadow
- captLocal
- commentFormatting
- commentedOutImport
- defaultCaseOrder
- deferUnlambda
- docStub
- dupImport
- elseif
- emptyFallthrough
- emptyStringTest
- hexLiteral
- ifElseChain
- importShadow
- initClause
- methodExprCall
- nestingReduce
- newDeref
- paramTypeCombine
- ptrToRefParam
- regexpMust
- regexpSimplify
- ruleguard
- singleCaseSwitch
- sloppyLen
- stringXbytes
- switchTrue
- typeAssertChain
- typeDefFirst
- typeSwitchVar
- typeUnparen
- underef
- unlabelStmt
- unlambda
- unnamedResult
- unnecessaryBlock
- unslice
- valSwap
- whyNoLint
- wrapperFunc
- yodaStyleExpr
- appendCombine
- equalFold
- hugeParam
- indexAlloc
- rangeExprCopy
- rangeValCopy
gocognit:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 15
gofumpt:
# Choose whether or not to use the extra rules that are disabled
# by default
extra-rules: true
lll:
# max line length, lines longer will be reported. Default is 120.
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
line-length: 120
# line-length: 160 # 160 is acceptable if needed
linters:
disable-all: true
enable:
- bodyclose
- cyclop
- deadcode
# - depguard
- dogsled
- dupl
- durationcheck
- errcheck
- errorlint
- exhaustive
- exportloopref
- forbidigo
- forcetypeassert
- funlen
- gochecknoglobals
- gochecknoinits
- gocognit
- gocritic
- goconst
- gocyclo
- gocognit
- godot
- godox
- goerr113
- gofmt
- gofumpt
- goimports
# - golint DEPRECATED https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md#may-2021
- gomnd
- gomoddirectives
- gosec
- gosimple
- govet
- ifshort
- ineffassign
- interfacer
- importas
- lll
- maligned
- makezero
- misspell
- nakedret
- nilerr
- nlreturn
- nestif
- noctx
- prealloc
- predeclared
- promlinter
- revive
- staticcheck
- structcheck
- tagliatelle
- thelper
- typecheck
- unconvert
- unparam
- unused
- varcheck
- wastedassign
- whitespace
- wrapcheck
- wsl
issues:
# # Independently from option `exclude` we use default exclude patterns,
# # it can be disabled by this option. To list all
# # excluded by default patterns execute `golangci-lint run --help`.
# # Default value for this option is true.
# exclude-use-default: false
# The list of ids of default excludes to include or disable. By default it's empty.
include:
- EXC0002 # disable excluding of issues about comments from golint
exclude-rules:
# Exclude some linters from running on tests files.
- path: _test\.go
linters:
- dupl
- gosec
# Exclude lll issues for long lines with go:generate
- linters:
- lll
source: "^//go:generate "
# Exclude lll and funlen in resolvers function names
- path: \.resolvers\.go
source: "^func \\("
linters:
- lll
- funlen
# Exclude lll and funlen in resolvers function names
- path: \.resolvers\.go
source: "(Query|All|Get|Only)"
linters:
- wrapcheck
# Exclude go critic typeDefFirst in resolvers type definitions
- path: \.resolvers\.go
text: "typeDefFirst:"
linters:
- gocritic
# Exclude gofumpt from trimping on multiple resolver type declarations:
# internal/graph/datum.resolvers.go:41: File is not `gofumpt`-ed (gofumpt)
# type datumResolver struct{ *Resolver }
# type mutationResolver struct{ *Resolver }
# type queryResolver struct{ *Resolver }
- path: \.resolvers\.go
source: "type.*?Resolver"
linters:
- gofumpt