-
Notifications
You must be signed in to change notification settings - Fork 4
/
.golangci.yml
208 lines (205 loc) · 5.64 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
linters:
disable-all: true
enable:
- asciicheck
- bidichk
- bodyclose
- containedctx
- copyloopvar
- depguard
- dogsled
- dupl
- errcheck
- errname
- errorlint
- exhaustive
- gci
- ginkgolinter
- goconst
- gocritic
- godot
- gofumpt
- gosec
- gosimple
- govet
- importas
- inamedparam
- ineffassign
- intrange
- ireturn
- loggercheck
- misspell
- musttag
- nakedret
- nilerr
- nolintlint
- nosprintfhostport
- prealloc
- perfsprint
- revive
- reassign
- staticcheck
- stylecheck
- tagalign
- testifylint
- tenv
- typecheck
- unconvert
- unparam
- unused
- whitespace
linters-settings:
depguard:
rules:
main:
deny:
- pkg: "github.com/pkg/errors"
desc: Should be replaced by stdlib errors package
gci:
sections:
- standard
- default
- prefix(github.com/ionos-cloud/cluster-api-provider-ionoscloud)
- blank
- dot
gosec:
excludes:
- G601 # Implicit memory aliasing of items from a range statement: Obsolete since Go 1.22
importas:
no-unaliased: true
alias:
# Kubernetes
- pkg: k8s.io/api/(\w+)/(v[\w\d]+)
alias: $1$2
- pkg: k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1
alias: apiextensionsv1
- pkg: k8s.io/apimachinery/pkg/apis/meta/v1
alias: metav1
- pkg: k8s.io/apimachinery/pkg/api/errors
alias: apierrors
- pkg: k8s.io/apimachinery/pkg/util/errors
alias: kerrors
# Controller Runtime
- pkg: sigs.k8s.io/controller-runtime
alias: ctrl
# Cluster API
- pkg: sigs.k8s.io/cluster-api/api/v1beta1
alias: clusterv1
- pkg: "sigs.k8s.io/cluster-api/test/e2e"
alias: capie2e
# Own module
- pkg: github.com/ionos-cloud/cluster-api-provider-ionoscloud/api/v1alpha1
alias: infrav1
- pkg: github.com/ionos-cloud/sdk-go/v6
alias: sdk
ireturn:
allow:
- error
- generic
- ionoscloud.Client
- bootstrap.ClusterProvider
- framework.ClusterProxy
loggercheck:
require-string-key: true
no-printf-like: true
revive:
enable-all-rules: true
rules:
- name: add-constant
disabled: true
- name: cognitive-complexity
arguments:
- 25
- name: cyclomatic
arguments:
- 15
- name: line-length-limit
disabled: true
- name: max-public-structs
disabled: true
- name: range-val-address
disabled: true # Obsolete since Go 1.22
- name: struct-tag
arguments:
- json,inline
- name: var-naming
arguments:
- [] # first list is an allow list. All initialisms placed here will be ignored
- [LAN, IP, NIC] # second list is a deny list. These rules will be enforced
testifylint:
enable-all: true
issues:
max-same-issues: 0
max-issues-per-linter: 0
# We are disabling default golangci exclusions because we want to help reviewers to focus on reviewing the most relevant
# changes in PRs and avoid nitpicking.
exclude-use-default: false
exclude-rules:
- linters:
- containedctx
path: '(.+)_test\.go'
- linters:
- gocritic
text: "appendAssign: append result not assigned to the same slice"
- linters:
- revive
text: "comment-spacings: no space between comment delimiter and comment text"
source: "//(\\+(kubebuilder|optional|required)|#nosec)"
- linters:
- revive
text: "exported: exported method .*\\.(Reconcile|SetupWithManager|SetupWebhookWithManager) should have comment or be unexported"
- linters:
- revive
text: maximum number of lines per function exceeded
path: suite_test.go
# Exclude some packages or code to require comments, for example test code, or fake clients.
- linters:
- revive
text: exported (method|function|type|const) (.+) should have comment or be unexported
source: (func|type).*Fake.*
- linters:
- revive
text: exported (method|function|type|const) (.+) should have comment or be unexported
path: fake_\.go
- linters:
- revive
text: exported (method|function|type|const) (.+) should have comment or be unexported
path: "(framework|e2e|infrastructure/docker)/.*.go"
- linters:
- revive
text: "line is \\d+ characters, out of limit \\d+"
source: "\\s*//\\+kubebuilder:.*"
- linters:
- revive
text: "line is \\d+ characters, out of limit \\d+"
# If a line comment ends with something that looks like a URL, we ignore the line length limit.
source: "\\s*//.*[-a-zA-Z0-9@:%_\\+.~#?&//=]{2,256}\\.[a-z]{2,4}\\b(\\/[-a-zA-Z0-9@:%_\\+.~#?&//=]*)?$"
- linters:
- revive
text: "function-length: maximum number of lines per function exceeded"
path: _test\.go
# Disable unparam "always receives" which might not be really
# useful when building libraries.
- linters:
- unparam
text: always receives
# Dot imports for gomega or ginkgo are allowed
# within test files.
- path: _test\.go
text: should not use dot imports
- path: _test\.go
text: cyclomatic complexity
# Append should be able to assign to a different var/slice.
- path: (framework|e2e)/.*.go
text: should not use dot imports
exclude-files:
- "zz_generated.*\\.go$"
- ".*conversion.*\\.go$"
exclude-dirs:
- mock*
run:
build-tags:
- e2e
timeout: 10m
allow-parallel-runners: true
go: "1.22"