forked from Kong/kubernetes-ingress-controller
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.golangci.yaml
178 lines (175 loc) · 5.27 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
run:
timeout: 10m
build-tags:
- integration_tests
- e2e_tests
- conformance_tests
- istio_tests
- envtest
linters:
enable:
- asasalint
- asciicheck
- bodyclose
- contextcheck
- dogsled
- durationcheck
- errcheck
- errname
- errorlint
- exhaustive
- exportloopref
- forbidigo
- gci
- godot
- gofmt
- gofumpt
- goimports
- gomodguard
- gosec
- gosimple
- govet
- importas
- ineffassign
- loggercheck
- megacheck
- misspell
- nakedret
- nilerr
- nolintlint
- predeclared
- revive
- staticcheck
- tenv
- typecheck
- unconvert
- unparam
- unused
- wastedassign
linters-settings:
exhaustive:
default-signifies-exhaustive: true
gci:
sections:
- standard
- default
- prefix(github.com/kong/kubernetes-ingress-controller/v3)
importas:
no-unaliased: true
alias:
- pkg: k8s.io/api/core/v1
alias: corev1
- pkg: k8s.io/api/apps/v1
alias: appsv1
- pkg: k8s.io/api/admission/v1
alias: admissionv1
- pkg: k8s.io/api/admissionregistration/v1
alias: admregv1
- pkg: k8s.io/api/discovery/v1
alias: discoveryv1
- pkg: k8s.io/api/networking/v1
alias: netv1
- pkg: k8s.io/apimachinery/pkg/types
alias: k8stypes
- pkg: k8s.io/apimachinery/pkg/util/validation
alias: utilvalidation
- pkg: k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1
alias: apiextensionsv1
- pkg: k8s.io/apimachinery/pkg/api/errors
alias: apierrors
- pkg: k8s.io/apimachinery/pkg/apis/meta/v1
alias: metav1
- pkg: sigs.k8s.io/gateway-api/apis/(v[\w\d]+)
alias: gateway${1}
- pkg: github.com/kong/kubernetes-ingress-controller/v[\w\d]+/pkg/apis/configuration/(v[\w\d]+)
alias: kong${1}
- pkg: github.com/kong/kubernetes-ingress-controller/v3/internal/dataplane/config
alias: dpconf
forbidigo:
exclude-godoc-examples: false
forbid:
- 'gatewayv1alpha2|gatewayv1beta1|gatewayv1(# use internal/gatewayapi aliases instead)?'
- 'CoreV1\(\)\.Endpoints(# use DiscoveryV1 EndpointSlices API instead)?'
- 'corev1\.Endpoint(# use DiscoveryV1 EndpointSlices API instead)?'
gomodguard:
blocked:
modules:
- github.com/ghodss/yaml:
recommendations:
- sigs.k8s.io/yaml
- gopkg.in/yaml.v2:
recommendations:
- sigs.k8s.io/yaml
- gopkg.in/yaml.v3:
recommendations:
- sigs.k8s.io/yaml
- github.com/pkg/errors:
recommendations:
- fmt
- errors
- golang.org/x/net/context:
recommendations:
- context
- k8s.io/utils/pointer:
recommendations:
- github.com/samber/lo
- github.com/sirupsen/logrus:
recommendations:
- go.uber.org/zap
- github.com/bombsimon/logrusr/v4:
recommendations:
- github.com/go-logr/zapr
- github.com/go-logr/logr
- github.com/kong/kubernetes-ingress-controller/v2:
recommendations:
- github.com/kong/kubernetes-ingress-controller/v3
tenv:
all: true
loggercheck:
kitlog: false
klog: true
logr: true
zap: false
issues:
fix: true
max-same-issues: 0
exclude-use-default: false
exclude:
# EXC0001 errcheck: Almost all programs ignore errors on these functions and in most cases it's ok
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
# EXC0002 golint: Annoying issue about not having a comment. The rare codebase has such comments
- (should have( a package)? comment)
# EXC0007 gosec: Too many false-positives for parametrized shell calls
- Subprocess launch(ed with variable|ing should be audited)
# EXC0008 gosec: Duplicated errcheck checks
- (G104)
# EXC0009 gosec: Too many issues in popular repos
- (Expect directory permissions to be 0750 or less|Expect file permissions to be 0600 or less)
# EXC0010 gosec: False positive is triggered by 'src, err := ioutil.ReadFile(filename)'
- Potential file inclusion via variable
exclude-rules:
# Ignore insecure TLS in tests and hardcoded credentials
- path: _test\.go
linters:
- gosec
text: "TLS InsecureSkipVerify set true|Potential hardcoded credentials"
# It's fine to use variable urls in tests.
- linters:
- gosec
text: "Potential HTTP request made with variable url"
path: test\.go
# Allow using SchemeGroupVersion, GroupVersion, GroupName, AddToScheme, and Install from gatewayv1alpha2,
# gatewayv1beta1 and gatewayv1 as their values are different between versions, and we can't alias them in internal/gatewayapi/aliases.go.
- linters:
- forbidigo
text: "use of `(gatewayv1alpha2|gatewayv1beta1|gatewayv1)\\.(SchemeGroupVersion|GroupVersion|GroupName|AddToScheme|Install)"
# Allow gatewayv1alpha2, gatewayv1beta1 and gatewayv1 types references in internal/gatewayapi/aliases.go as that
# should be the only place where we use them.
- linters:
- forbidigo
text: "use of `(gatewayv1alpha2|gatewayv1beta1|gatewayv1)"
path: (internal/gatewayapi/aliases.go|pkg/apis/.*/.*\.go)
- linters:
- revive
text: "var-declaration: should drop = 0 from declaration of var .*; it is the zero value"
path: \.go