forked from kubernetes-sigs/cluster-api-provider-cloudstack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.golangci.yml
204 lines (198 loc) · 4.99 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
linters-settings:
cyclop:
max-complexity: 20
gci:
sections:
- standard
- default
- prefix(sigs.k8s.io/cluster-api-provider-cloudstack)
ginkgolinter:
forbid-focus-container: true
godot:
# declarations - for top level declaration comments (default);
# toplevel - for top level comments;
# all - for all comments.
scope: toplevel
exclude:
- '^ \+.*'
- '^ ANCHOR.*'
gocritic:
enabled-tags:
- diagnostic
- experimental
- performance
disabled-checks:
- appendAssign
- dupImport # https://github.com/go-critic/go-critic/issues/845
- emptyStringTest
- evalOrder
- ifElseChain
- octalLiteral
- regexpSimplify
- sloppyReassign
- truncateCmp
- typeDefFirst
- unnamedResult
- unnecessaryDefer
- whyNoLint
- wrapperFunc
- rangeValCopy
- hugeParam
gocyclo:
min-complexity: 15
goheader:
values:
const:
AUTHOR: The Kubernetes Authors
regexp:
YR: '\d\d\d\d'
template: |-
Copyright {{ YR }} {{ AUTHOR }}.
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.
goimports:
local-prefixes: sigs.k8s.io/cluster-api-provider-cloudstack
nestif:
# minimal complexity of if statements to report, 5 by default
min-complexity: 8
nolintlint:
allow-unused: false
allow-leading-space: false
require-specific: true
revive:
rules:
# The following rules are recommended https://github.com/mgechev/revive#recommended-configuration
- name: blank-imports
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
arguments:
# dot import should be ONLY allowed for ginkgo testing packages
allowedPackages:
- "github.com/onsi/ginkgo/v2"
- "github.com/onsi/gomega"
- name: error-return
- name: error-strings
- name: error-naming
- name: exported
- name: if-return
- name: increment-decrement
- name: var-naming
- name: var-declaration
- name: package-comments
- name: range
- name: receiver-naming
- name: time-naming
- name: unexported-return
- name: indent-error-flow
- name: errorf
- name: empty-block
- name: superfluous-else
- name: unused-parameter
- name: unreachable-code
- name: redefines-builtin-id
#
# Rules in addition to the recommended configuration above.
#
- name: bool-literal-in-expr
- name: constant-logical-expr
goconst:
ignore-tests: true
linters:
disable-all: true
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- copyloopvar
- dogsled
- dupword
- durationcheck
- errcheck
- errchkjson
- gci
- ginkgolinter
- goconst
- gocritic
- godot
- gofmt
- goimports
- goprintffuncname
- gosec
- gosimple
- govet
- importas
- ineffassign
- intrange
- loggercheck
- misspell
- nakedret
- nilerr
- noctx
- nolintlint
- nosprintfhostport
- prealloc
- predeclared
- revive
- rowserrcheck
- staticcheck
- stylecheck
- tenv
- thelper
- typecheck
- unconvert
- unparam
- unused
- usestdlibvars
- whitespace
run:
timeout: 10m
go: "1.22"
build-tags:
- tools
- e2e
allow-parallel-runners: true
issues:
max-same-issues: 0
max-issues-per-linter: 0
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-dirs:
- pkg/mocks
- test
exclude-rules:
# Exclude some linters from running on tests files.
- path: _test\.go
linters:
- dupl
- gosec
- text: "SA1019: .+LBRuleID is deprecated"
linters:
- staticcheck
- path: api/v1beta3/webhook_suite_test.go
linters:
- goimports
- linters:
- revive
- stylecheck
path: (test)/.*.go
text: should not use dot imports
- linters:
- revive
# This rule warns when initialism, variable or package naming conventions are not followed.
text: "var-naming: don't use underscores in Go names;"
# Ignoring stylistic checks for generated code
path: api\/.*\/.*conversion.*\.go$
- linters:
- stylecheck
text: "ST1003: should not use underscores in Go names;"
path: api\/.*\/.*conversion.*\.go$
exclude-files:
- "zz_generated.*\\.go$"