-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.golangci.yaml
269 lines (242 loc) · 7.46 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
# This file contains all available configuration options
# with their default values.
# options for analysis running
run:
# default concurrency is a available CPU number
concurrency: 4
# timeout for analysis, e.g. 30s, 5m, default is 1m
timeout: 10m
# exit code when at least one issue was found, default is 1
issues-exit-code: 0
# include test files or not, default is true
tests: false
# list of build tags, all linters use it. Default is empty list.
build-tags: []
# which dirs to skip: issues from them won't be reported;
# can use regexp here: generated.*, regexp is applied on full path;
# default value is empty list, but default dirs are skipped independently
# from this option's value (see skip-dirs-use-default).
# "/" will be replaced by current OS file path separator to properly work
# on Windows.
skip-dirs:
- docs
# default is true. Enables skipping of directories:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs-use-default: true
# which files to skip: they will be analyzed, but issues from them
# won't be reported. Default value is empty list, but there is
# no need to include all autogenerated files, we confidently recognize
# autogenerated files. If it's not please let us know.
# "/" will be replaced by current OS file path separator to properly work
# on Windows.
skip-files:
- ".*\\._mock\\.go$"
- ".*\\.pb\\.go$"
# Allow multiple parallel golangci-lint instances running.
# If false (default) - golangci-lint acquires file lock on start.
allow-parallel-runners: false
# output configuration options
output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions
# default is "colored-line-number"
format: tab
# print lines of code with issue, default is true
print-issued-lines: true
# print linter name in the end of issue text, default is true
print-linter-name: true
# make issues output unique by line, default is true
uniq-by-line: true
# add a prefix to the output file references; default is no prefix
path-prefix: ""
# sorts results by: filepath, line and column
sort-results: false
# all available settings of specific linters
linters-settings:
gosec:
exclude-functions:
- crypto/md5.Sum
errcheck:
# report about not checking of errors in type assertions: `a := b.(MyStruct)`;
# default is false: such cases aren't reported by default.
check-type-assertions: false
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
# default is false: such cases aren't reported by default.
check-blank: false
# [deprecated] comma-separated list of pairs of the form pkg:regex
# the regex is used to ignore names within pkg. (default "fmt:.*").
# see https://github.com/kisielk/errcheck#the-deprecated-method for details
ignore: fmt:.*,io/ioutil:^Read.*
# list of functions to exclude from checking, where each entry is a single function to exclude.
# see https://github.com/kisielk/errcheck#excluding-functions for details
exclude-functions:
- io/ioutil.ReadFile
- io.Copy(*bytes.Buffer)
- io.Copy(os.Stdout)
gofmt:
# simplify code: gofmt with `-s` option, true by default
simplify: true
gci:
skip-generated: true
custom-order: true
sections:
- standard # Standard section: captures all standard packages.
- default # Default section: contains all imports that could not be matched to another section type.
- prefix(github.com/inDriver) # Custom section: groups all imports with the specified Prefix.
goimports:
# put imports beginning with prefix after 3rd-party packages;
# it's a comma-separated list of prefixes
local-prefixes: github.com/inDriver
revive:
# see https://github.com/mgechev/revive#available-rules for details.
rules:
- name: context-keys-type
# - name: time-equal
- name: time-naming
- name: var-declaration
- name: unexported-return
disabled: true
- name: errorf
- name: blank-imports
- name: context-as-argument
- name: dot-imports
- name: error-return
- name: error-strings
- name: error-naming
- name: if-return
disabled: true
- name: increment-decrement
# TODO: разобраться с don't use an underscore in package name
- name: var-naming
disabled: true
- name: package-comments
- name: range
- name: receiver-naming
- name: indent-error-flow
disabled: true
- name: argument-limit
arguments:
- 10
- name: cyclomatic
disabled: true
- name: max-public-structs
disabled: true
- name: file-header
disabled: true
- name: empty-block
- name: superfluous-else
- name: confusing-naming
- name: get-return
disabled: true
- name: modifies-parameter
# - name: confusing-results
- name: deep-exit
disabled: true
- name: unused-parameter
- name: unreachable-code
- name: add-constant
disabled: true
arguments:
- maxLitCount: "3"
- name: flag-parameter
disabled: true
- name: unnecessary-stmt
disabled: true
- name: struct-tag
- name: modifies-value-receiver
- name: constant-logical-expr
- name: bool-literal-in-expr
- name: redefines-builtin-id
- name: function-result-limit
arguments:
- 3
- name: imports-blacklist
- name: range-val-in-closure
- name: range-val-address
- name: waitgroup-by-value
- name: atomic
- name: empty-lines
disabled: true
- name: line-length-limit
arguments:
- 300
- name: call-to-gc
- name: duplicated-imports
- name: import-shadowing
- name: bare-return
- name: unused-receiver
disabled: true
- name: unhandled-error
arguments:
- "fmt.Printf"
- "fmt.Println"
- "strings.Builder.WriteString"
- "bytes.Buffer.WriteString"
- "go/printer.Fprint"
- name: cognitive-complexity
disabled: true
- name: string-of-int
- name: string-format
- name: early-return
disabled: true
- name: unconditional-recursion
- name: identical-branches
- name: defer
- name: unexported-naming
- name: function-length
arguments:
- 80
- 0
- name: nested-structs
disabled: true
- name: useless-break
disabled: true
gocognit:
# Minimal code complexity to report
# Default: 30 (but we recommend 10-20)
min-complexity: 20
nakedret:
# Make an issue if func has more lines of code than this setting, and it has naked returns.
# Default: 30
max-func-lines: 5
linters:
disable-all: true
enable:
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- typecheck
- unused
# non-default
- asciicheck
- bidichk
- bodyclose
- errcheck
- goconst
# - godot
- gofmt
- gosec
- gosimple
- govet
- ineffassign
- megacheck
- unconvert
- unused
- makezero
- nilerr
- noctx
- rowserrcheck
- sqlclosecheck
- misspell
- goimports
- gocritic
- revive
- gocognit
- nakedret
enable-all: false
disable: []
# presets:
# - bugs
# - unused
fast: false