-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy path.golangci.yml
More file actions
219 lines (200 loc) · 4.94 KB
/
.golangci.yml
File metadata and controls
219 lines (200 loc) · 4.94 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
version: "2"
linters:
enable:
- arangolint
- asasalint
- asciicheck
- bidichk
- bodyclose
- canonicalheader
- containedctx
- contextcheck
- copyloopvar
- cyclop
- decorder
- dogsled
- dupl
- dupword
- durationcheck
- embeddedstructfieldcheck
- errcheck
- errchkjson
- errname
- errorlint
- exhaustive
- exptostd
- fatcontext
- forbidigo
- forcetypeassert
- funcorder
- funlen
- ginkgolinter
- gocheckcompilerdirectives
- gochecknoglobals
- gochecknoinits
- gochecksumtype
- gocognit
- goconst
- gocritic
- gocyclo
- godoclint
- godot
- godox
- goheader
- gomoddirectives
- gomodguard
- goprintffuncname
- gosec
- gosmopolitan
- govet
- grouper
- iface
- importas
- inamedparam
- ineffassign
- interfacebloat
- intrange
- iotamixing
- lll
- loggercheck
- maintidx
- makezero
- mirror
- misspell
- mnd
- musttag
- nakedret
- nestif
- nilerr
- nilnesserr
- nilnil
- nlreturn
- noctx
- noinlineerr
- nolintlint
- nosprintfhostport
- perfsprint
- prealloc
- predeclared
- promlinter
- protogetter
- reassign
- recvcheck
- revive
- rowserrcheck
- sloglint
- spancheck
- sqlclosecheck
- staticcheck
- tagalign
- tagliatelle
- testableexamples
- testifylint
- testpackage
- thelper
- tparallel
- unconvert
- unparam
- unqueryvet
- unused
- usestdlibvars
- usetesting
- varnamelen
- wastedassign
- whitespace
- wrapcheck
- wsl_v5
- zerologlint
disable:
- depguard # We will need to configure the allowed dependencies before enabling this
- embeddedstructfieldcheck # Would require extensive struct reorganization
- err113 # We're okay with dynamic errors for most cases; no way to only disable that check.
- exhaustruct # We don't require explicitly initializing each field of a struct at construction time.
- funcorder # Would require extensive code reorganization
- godoclint # Would require updating all function documentation comments
- ireturn # We are philosophically opposed to banning interface returns.
- noinlineerr # We prefer inline error handling for readability
- nonamedreturns # We *intentionally* like named returns.
- paralleltest # We're not going to add t.Parallel() to every test for now.
settings:
cyclop:
max-complexity: 15
forbidigo:
forbid:
- pattern: '^exec\.Command$'
msg: "exec.CommandContext must be used instead (with a valid ctx.Context)"
funlen:
lines: 80
goheader:
template: |-
Copyright (c) Microsoft Corporation.
Licensed under the MIT License.
gosec:
excludes:
- G204 # Audit use of command execution
revive:
rules:
- name: empty-block
disabled: true # Allow empty blocks for readability.
- name: exported
disabled: false # Enable revive checks on package-exported functions and types.
arguments:
- disableStutteringCheck # For now, disable the check against a package symbol being prefixed with the package name.
- checkPublicInterface
- name: package-comments
disabled: false # Enable revive checks on package comments.
tagalign:
order:
- toml
- json
- table
- validate
- jsonschema
tagliatelle:
case:
rules:
json: camel
varnamelen:
ignore-decls:
- fs opctx.FS # 'fs' is a reasonable variable for an `FS`
wrapcheck:
extra-ignore-sigs:
- .PrintAndReturnError( # This function wraps errors and returns them, so we need to ignore it since it looks like an unwrapped error
exclusions:
presets:
# TODO: gradually remove these exclusions as we can.
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
# Don't complain about long lines that may contain struct tags; they can't be wrapped.
- linters:
- lll
source: '`[^`]*`\s*$'
# Don't complain about forbidden functions in our magefiles
- linters:
- forbidigo
path: magefiles
# Don't complain about missing public function comments in our magefiles
- linters:
- revive
path: magefiles
text: .*should have comment.*
# We don't worry about error wrapping tests.
- linters:
- wrapcheck
path: '(.+)_test\.go'
- linters:
# Allow long tests, particularly for data-driven ones.
- funlen
- gocognit
- cyclop
path: '(.+)_test\.go'
# TODO: enable all formatters we know about (including golines)
formatters:
enable:
- gci
- gofmt
- gofumpt
- goimports