-
Notifications
You must be signed in to change notification settings - Fork 1
/
.golangci.yml
181 lines (174 loc) · 4.68 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
# Linter selection and configuration file for golangci-lint.
linters:
# Disable all linters. It's important to have reproducible CI: don't start to fail all builds at the same time.
# With golangci-lint this can happen if you use option --enable-all and a new linter is added
# or when one upstream linter is upgraded.
# Default: false
disable-all: true
# Enable specific linter
# If linters should be disabled, comment out the respective line with explaination.
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- canonicalheader
- containedctx
- contextcheck
- copyloopvar
- cyclop
- decorder
#- depguard - no package black list needed for now
- dogsled
- dupl
- dupword
- durationcheck
#- err113 - enable after refactoring
- errcheck
- errchkjson
- errname
#- errorlint - enable after refactoring
# - execinquery - deprecated
#- exhaustive - It's ok not not set every field in a struct
#- exhaustruct - It's ok not not set every field in a struct
- exportloopref
- fatcontext
- forbidigo
- forcetypeassert
- funlen
- gci
- ginkgolinter
- gocheckcompilerdirectives
- gochecknoglobals
#- gochecknoinits - init functions are needed for the plugin system
- gochecksumtype
- gocognit
- goconst
- gocritic
- gocyclo
- godot
- godox
- gofmt
#- gofumpt - no idea what format it checks, output is not helpful
- goheader
- goimports
- gomoddirectives
- gomodguard
- goprintffuncname
- gosec
- gosimple
- gosmopolitan
- govet
- grouper
- importas
- inamedparam
- ineffassign
- interfacebloat
- intrange
- ireturn
- lll
- loggercheck
- maintidx
- makezero
- mirror
- misspell
- mnd
#- musttag - Not all fields need to be tagged for YAML parsing, as the default way of assigning is fine.
- nakedret
- nestif
- nilerr
- nilnil
- nlreturn
- noctx
- nolintlint
- nonamedreturns
- nosprintfhostport
#- paralleltest - Not necessary to do parallel tests for now, might enable later again
#- perfsprint - Using fmt.Sprintf is fine, performance is not an issue.
- prealloc
- predeclared
- promlinter
- protogetter
- reassign
- revive
- rowserrcheck
- sloglint
- spancheck
- sqlclosecheck
- staticcheck
- stylecheck
- tagalign
- tagliatelle
- tenv
- testableexamples
- testifylint
#- testpackage - We don't enforce white box testing
- thelper
- tparallel
- typecheck
- unconvert
- unparam
- unused
- usestdlibvars
- varnamelen
- wastedassign
- whitespace
#- wrapcheck - Not ALL error should be wrapped, as they become part of the function API then.
- wsl
- zerologlint
# Options for analysis running.
run:
# Include test files or not.
# Default: true
tests: false
# Settings of specific linters.
linters-settings:
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.
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
- alias # Alias section: contains all alias imports. This section is not present unless explicitly enabled.
ireturn:
# List of interfaces to allow.
# Lists of the keywords and regular expressions matched to interface or package names can be used.
# `allow` and `reject` settings cannot be used at the same time.
#
# Keywords:
# - `empty` for `interface{}`
# - `error` for errors
# - `stdlib` for standard library
# - `anon` for anonymous interfaces
# - `generic` for generic interfaces added in go 1.18
#
# Default: [anon, error, empty, stdlib]
allow:
- anon
- error
- empty
- stdlib
- generic
- "Module"
lll:
line-length: 140
nestif:
min-complexity: 6
varnamelen:
max-distance: 6
ignore-type-assert-ok: true
ignore-map-index-ok: true
ignore-chan-recv-ok: true
ignore-names:
- err
- wg # WaitGroup
- s # Session
- ch # Channel
- tt # Test Table
- r # Reader
- fs # FlagSet
- "on" # On/Off