-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.golangci.yml
379 lines (357 loc) · 12.2 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
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
linters-settings:
depguard:
# new configuration
rules:
logger:
deny:
- pkg: "github.com/sirupsen/logrus"
desc: logging is allowed only by github.com/obalunenko/logger
dupl:
threshold: 100
funlen:
lines: 100
statements: 50
gci:
# Section configuration to compare against.
# Section names are case-insensitive and may contain parameters in ().
# The default order of sections is `standard > default > custom > blank > dot > alias > localmodule`,
# If `custom-order` is `true`, it follows the order of `sections` option.
# Default: ["standard", "default"]
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/obalunenko/advent-of-code) # Custom section: groups all imports with the specified Prefix.
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
- alias # Alias section: contains all alias imports. This section is not present unless explicitly enabled.
- localmodule # Local module section: contains all local packages. This section is not present unless explicitly enabled.
# Skip generated files.
# Default: true
skip-generated: false
# Enable custom order of sections.
# If `true`, make the section order the same as the order of `sections`.
# Default: false
custom-order: true
# Drops lexical ordering for custom sections.
# Default: false
no-lex-order: true
goconst:
min-len: 2
min-occurrences: 2
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- dupImport # https://github.com/go-critic/go-critic/issues/845
- ifElseChain
- hugeParam
- octalLiteral
- wrapperFunc
gocyclo:
min-complexity: 15
goimports:
local-prefixes: github.com/obalunenko/advent-of-code
mnd:
# List of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description.
# Default: ["argument", "case", "condition", "operation", "return", "assign"]
checks:
- argument
- case
- condition
- operation
- return
- assign
# List of numbers to exclude from analysis.
# The numbers should be written as string.
# Values always ignored: "1", "1.0", "0" and "0.0"
# Default: []
ignored-numbers: []
# List of file patterns to exclude from analysis.
# Values always ignored: `.+_test.go`
# Default: []
ignored-files: []
# List of function patterns to exclude from analysis.
# Following functions are always ignored: `time.Date`,
# `strconv.FormatInt`, `strconv.FormatUint`, `strconv.FormatFloat`,
# `strconv.ParseInt`, `strconv.ParseUint`, `strconv.ParseFloat`.
# Default: []
ignored-functions: []
govet:
# Disable all analyzers.
# Default: false
disable-all: false
# Enable analyzers by name.
# (in addition to default:
# appends, asmdecl, assign, atomic, bools, buildtag, cgocall, composites, copylocks, defers, directive, errorsas,
# framepointer, httpresponse, ifaceassert, loopclosure, lostcancel, nilfunc, printf, shift, sigchanyzer, slog,
# stdmethods, stringintconv, structtag, testinggoroutine, tests, timeformat, unmarshal, unreachable, unsafeptr,
# unusedresult
# ).
# Run `GL_DEBUG=govet golangci-lint run --enable=govet` to see default, all available analyzers, and enabled analyzers.
# Default: []
disable:
- fieldalignment
enable:
# Check for missing values after append.
- appends
# Report mismatches between assembly files and Go declarations.
- asmdecl
# Check for useless assignments.
- assign
# Check for common mistakes using the sync/atomic package.
- atomic
# Check for non-64-bits-aligned arguments to sync/atomic functions.
- atomicalign
# Check for common mistakes involving boolean operators.
- bools
# Check //go:build and // +build directives.
- buildtag
# Detect some violations of the cgo pointer passing rules.
- cgocall
# Check for unkeyed composite literals.
- composites
# Check for locks erroneously passed by value.
- copylocks
# Check for calls of reflect.DeepEqual on error values.
- deepequalerrors
# Report common mistakes in defer statements.
- defers
# Check Go toolchain directives such as //go:debug.
- directive
# Report passing non-pointer or non-error values to errors.As.
- errorsas
# Find calls to a particular function.
- findcall
# Report assembly that clobbers the frame pointer before saving it.
- framepointer
# Check for mistakes using HTTP responses.
- httpresponse
# Detect impossible interface-to-interface type assertions.
- ifaceassert
# Check references to loop variables from within nested functions.
- loopclosure
# Check cancel func returned by context.WithCancel is called.
- lostcancel
# Check for useless comparisons between functions and nil.
- nilfunc
# Check for redundant or impossible nil comparisons.
- nilness
# Check consistency of Printf format strings and arguments.
- printf
# Check for comparing reflect.Value values with == or reflect.DeepEqual.
- reflectvaluecompare
# Check for possible unintended shadowing of variables.
- shadow
# Check for shifts that equal or exceed the width of the integer.
- shift
# Check for unbuffered channel of os.Signal.
- sigchanyzer
# Check for invalid structured logging calls.
- slog
# Check the argument type of sort.Slice.
- sortslice
# Check signature of methods of well-known interfaces.
- stdmethods
# Check for string(int) conversions.
- stringintconv
# Check that struct field tags conform to reflect.StructTag.Get.
- structtag
# Report calls to (*testing.T).Fatal from goroutines started by a test.
- testinggoroutine
# Check for common mistaken usages of tests and examples.
- tests
# Check for calls of (time.Time).Format or time.Parse with 2006-02-01.
- timeformat
# Report passing non-pointer or non-interface values to unmarshal.
- unmarshal
# Check for unreachable code.
- unreachable
# Check for invalid conversions of uintptr to unsafe.Pointer.
- unsafeptr
# Check for unused results of calls to some functions.
- unusedresult
# Checks for unused writes.
- unusedwrite
lll:
line-length: 140
misspell:
locale: US
nolintlint:
allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space)
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
linters:
disable-all: true
enable:
- bodyclose
- depguard
- dogsled
- dupl
- errcheck
- copyloopvar
- exhaustive
- funlen
- gochecknoinits
- goconst
- gocritic
- gocyclo
- gofmt
- goimports
- mnd
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- lll
- misspell
- nakedret
- noctx
- nolintlint
- rowserrcheck
- staticcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- whitespace
- revive
- wsl
# don't enable:
# - asciicheck
# - scopelint
# - gochecknoglobals
# - gocognit
# - godot
# - godox
# - goerr113
# - interfacer
# - maligned
# - nestif
# - prealloc
# - testpackage
issues:
# Show only new issues: if there are unstaged changes or untracked files,
# only those changes are analyzed, else only changes in HEAD~ are analyzed.
# It's a super-useful option for integration of golangci-lint into existing
# large codebase. It's not practical to fix all existing issues at the moment
# of integration: much better don't allow issues in new code.
# Default is false.
new: false
# Fix found issues (if it's supported by the linter)
fix: false
exclude-files:
- \.pb\.go$
exclude-dirs:
- vendor/
exclude-use-default: false
exclude:
# for "public interface + private struct implementation" cases only!
- exported func * returns unexported type *, which can be annoying to use
- should have a package comment, unless it's in another file for this package
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
# Exclude some linters from running on tests files.
- path: _test\.go
linters:
- gocyclo
- funlen
- dupl
- gosec
- path: internal/input/
linters:
- gocyclo
- funlen
- godot
- godox
- dupl
- gofmt
- gci
- gofumpt
- goimports
- gosimple
- path: internal/puzzles/constants.go
linters:
- revive
- path: internal/puzzles/solutions/
linters:
- gochecknoinits
run:
issues-exit-code: 0
tests: true
severity:
# Set the default severity for issues.
#
# If severity rules are defined and the issues do not match or no severity is provided to the rule
# this will be the default severity applied.
# Severities should match the supported severity names of the selected out format.
# - Code climate: https://docs.codeclimate.com/docs/issues#issue-severity
# - Checkstyle: https://checkstyle.sourceforge.io/property_types.html#SeverityLevel
# - GitHub: https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message
# - TeamCity: https://www.jetbrains.com/help/teamcity/service-messages.html#Inspection+Instance
#
# `@linter` can be used as severity value to keep the severity from linters (e.g. revive, gosec, ...)
#
# Default: ""
default-severity: error
# If set to true `severity-rules` regular expressions become case-sensitive.
# Default: false
case-sensitive: true
# When a list of severity rules are provided, severity information will be added to lint issues.
# Severity rules have the same filtering capability as exclude rules
# except you are allowed to specify one matcher per severity rule.
#
# `@linter` can be used as severity value to keep the severity from linters (e.g. revive, gosec, ...)
#
# Only affects out formats that support setting severity information.
#
# Default: []
rules:
- linters:
- dupl
severity: info
# output configuration options
output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions
# default is "colored-line-number"
formats:
- format: colored-line-number
path: stderr
- format: checkstyle
path: linters-report.xml
# Order to use when sorting results.
# Require `sort-results` to `true`.
# Possible values: `file`, `linter`, and `severity`.
#
# If the severity values are inside the following list, they are ordered in this order:
# 1. error
# 2. warning
# 3. high
# 4. medium
# 5. low
# Either they are sorted alphabetically.
#
# Default: ["file"]
sort-order:
- linter
- severity
- file # filepath, line, and column.
# Show statistics per linter.
# Default: false
show-stats: true
# 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: true