-
Notifications
You must be signed in to change notification settings - Fork 1
/
.golangci.yaml
214 lines (209 loc) · 6.47 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
linters:
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- containedctx
- contextcheck
- copyloopvar
- cyclop
- decorder
- dogsled
- dupl
# - dupword # very unergonomic to deal with false positives
- durationcheck
- errcheck
- errchkjson
- errname
- errorlint
- exhaustive
- exhaustruct
- forbidigo
# - forcetypeassert # type assertions are explicitly desired
# - funlen # just measure cyclomatic complexity
- gci
- ginkgolinter
- gocheckcompilerdirectives
- gochecknoinits
- gochecksumtype
- gocognit
- goconst
- gocritic
# - gocyclo # prefer cyclop
- godot
# - godox
- err113
- gofmt
- gofumpt
- goheader
- goimports
- gomoddirectives
# - gomodguard # does not work with workspaces
- goprintffuncname
- gosec
- gosimple
- gosmopolitan
- govet
- grouper
- importas
- inamedparam
- ineffassign
- interfacebloat
- intrange
- lll
- loggercheck
- maintidx
- makezero
- mirror
- misspell
- mnd
- musttag
- nakedret
- nestif
- nilerr
- nilnil
- noctx
- nolintlint
# - nonamedreturns # cannot isolate cases used for documentation or zero values
- nosprintfhostport
- paralleltest
# - perfsprint # micro optimization
- prealloc
- predeclared
- promlinter
- protogetter
- reassign
- revive
- rowserrcheck
- sloglint
- spancheck
- sqlclosecheck
- staticcheck
- stylecheck
- tagalign
- tagliatelle
- tenv
- testableexamples
- testifylint
- testpackage
# - thelper # most helper functions are not low-level assertions
- tparallel
- typecheck
- unconvert
- unparam
- unused
- usestdlibvars
- varnamelen
- wastedassign
- whitespace
- wrapcheck
- wsl
- zerologlint
linters-settings:
gci:
sections:
- standard
- default
- 'prefix(section/1,github.com/kubewharf/podseidon/api,github.com/kubewharf/podseidon/client)'
- 'prefix(section/2,github.com/kubewharf/podseidon/util)'
- 'prefix(section/3,github.com/kubewharf/podseidon/generator,github.com/kubewharf/podseidon/aggregator,github.com/kubewharf/podseidon/webhook)'
- 'prefix(section/4,github.com/kubewharf/podseidon)'
goheader:
template: |
Copyright {{ YEAR }} The Podseidon Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
gomoddirectives:
replace-local: true
gosec:
excludes:
- G404 # allow math/rand
importas:
no-unaliased: true
alias:
- pkg: k8s.io/apimachinery/pkg/api/errors
alias: apierrors
- pkg: k8s.io/apimachinery/pkg/apis/meta/v1
alias: metav1
- pkg: k8s.io/api/(?P<group>[\w\d]+)/(?P<s1>v\d+)((?P<s2>\w)\w+(?P<s3>\d+))?
alias: ${group}${s1}${s2}${s3}
- pkg: k8s.io/client-go/kubernetes/typed/(?P<group>[\w\d]+)/(?P<s1>v\d+)((?P<s2>\w)\w+(?P<s3>\d+))?
alias: ${group}${s1}${s2}${s3}client
- pkg: k8s.io/client-go/informers/(?P<group>[\w\d]+)/(?P<s1>v\d+)((?P<s2>\w)\w+(?P<s3>\d+))?
alias: ${group}${s1}${s2}${s3}informers
- pkg: k8s.io/client-go/listers/(?P<group>[\w\d]+)/(?P<s1>v\d+)((?P<s2>\w)\w+(?P<s3>\d+))?
alias: ${group}${s1}${s2}${s3}listers
- pkg: github.com/kubewharf/podseidon/apis/(?P<s1>v\d+)((?P<s2>\w)\w+(?P<s3>\d+))?
alias: podseidon${s1}${s2}${s3}
- pkg: github.com/kubewharf/podseidon/client/clientset/versioned
alias: podseidonclient
- pkg: github.com/kubewharf/podseidon/client/clientset/versioned/fake
alias: podseidonfakeclient
- pkg: github.com/kubewharf/podseidon/client/clientset/versioned/typed/apis/(?P<s1>v\d+)((?P<s2>\w)\w+(?P<s3>\d+))?
alias: podseidon${s1}${s2}${s3}client
- pkg: github.com/kubewharf/podseidon/client/informers/externalversions
alias: podseidoninformers
- pkg: github.com/kubewharf/podseidon/client/informers/externalversions/apis/(?P<s1>v\d+)((?P<s2>\w)\w+(?P<s3>\d+))?
alias: podseidon${s1}${s2}${s3}informers
- pkg: github.com/kubewharf/podseidon/client/listers/apis/(?P<s1>v\d+)((?P<s2>\w)\w+(?P<s3>\d+))?
# fedcorev1a1listers
alias: podseidon${s1}${s2}${s3}listers
lll:
line-length: 140
mnd:
ignored-numbers: ['0', '1', '2', '3', '4', '8', '16', '32', '64', '0.', '1.', '100.']
ignored-functions:
- 'fs\.(Duration|Int[0-9]*)'
- 'utilflag\.(Uint[0-9]*|Int[0-9]*)'
- 'metrics\.ExponentialIntHistogram'
revive:
enable-all-rules: true
rules:
- name: var-naming
disabled: true # disable initialism check
- name: line-length-limit
disabled: true # covered by lll
- name: add-constant
disabled: true # covered by mnd
- name: cognitive-complexity
disabled: true # covered by gocognit
- name: cyclomatic
disabled: true # covered by cyclop
- name: unchecked-type-assertion
disabled: true # type assertions are explicitly desired
- name: max-public-structs
disabled: true # too strict
- name: confusing-naming
disabled: true # does not work correctly, detects duplications across multiple types
- name: flag-parameter
disabled: true # too strict
- name: function-length
disabled: true # too strict, gocognit is sufficient
- name: empty-block
disabled: true # empty blocks are almost always intentional
stylecheck:
initialisms: [DISABLED]
varnamelen:
min-name-length: 2
wrapcheck:
ignoreSigs:
- 'errors.Tag'
- 'errors.TagErrorf'
- 'errors.TagWrapf'
- 'errors.Join'
- 'TryForEach'
wsl:
allow-separated-leading-comment: true
# used to document the control flow of an else branch when the block ends with a single-sided condition
allow-trailing-comment: true
issues:
exclude:
- 'v1(alpha1)?\.[A-Za-z]+ is missing field' # k8s proto structs are intentionally optional