1
+ version : " 2"
2
+ run :
3
+ build-tags :
4
+ - tools
5
+ - e2e
6
+ allow-parallel-runners : true
1
7
linters :
2
- disable-all : true
8
+ default : none
3
9
enable :
4
10
- asasalint
5
11
- asciicheck
@@ -10,18 +16,11 @@ linters:
10
16
- dogsled
11
17
- errcheck
12
18
- errchkjson
13
- # - gci
14
19
- goconst
15
- # - gocritic
16
20
- gocyclo
17
21
- godot
18
- - gofmt
19
- - goimports
20
22
- goprintffuncname
21
- # - gosec
22
- - gosimple
23
23
- govet
24
- # - importas
25
24
- ineffassign
26
25
- misspell
27
26
- nakedret
@@ -32,170 +31,159 @@ linters:
32
31
- prealloc
33
32
- predeclared
34
33
- reassign
35
- # - revive
36
34
- rowserrcheck
37
- - staticcheck
38
- # - stylecheck
39
- # - thelper
40
- - typecheck
35
+ # - staticcheck
41
36
- unconvert
42
37
- unparam
43
38
- unused
44
39
- usestdlibvars
45
40
- whitespace
46
-
47
- linters-settings :
48
- gocyclo :
49
- min-complexity : 20
50
- godot :
51
- # declarations - for top level declaration comments (default);
52
- # toplevel - for top level comments;
53
- # all - for all comments.
54
- scope : toplevel
55
- exclude :
56
- - ' ^ \+.*'
57
- - ' ^ ANCHOR.*'
58
- gci :
59
- sections :
60
- - standard
61
- - default
62
- - prefix(github.com/IBM)
63
- - prefix(k8s.io)
64
- - prefix(sigs.k8s.io)
65
- - blank
66
- - dot
67
- importas :
68
- no-unaliased : true
69
- alias :
70
- # Kubernetes
71
- - pkg : k8s.io/api/core/v1
72
- alias : corev1
73
- - pkg : k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1
74
- alias : apiextensionsv1
75
- - pkg : k8s.io/apimachinery/pkg/apis/meta/v1
76
- alias : metav1
77
- - pkg : k8s.io/apimachinery/pkg/api/errors
78
- alias : apierrors
79
- - pkg : k8s.io/apimachinery/pkg/util/errors
80
- alias : kerrors
81
- # Controller Runtime
82
- - pkg : sigs.k8s.io/controller-runtime
83
- alias : ctrl
84
- nolintlint :
85
- allow-unused : false
86
- # allow-leading-space: false
87
- require-specific : true
88
- gosec :
89
- excludes :
90
- - G307 # Deferring unsafe method "Close" on type "\*os.File"
91
- - G108 # Profiling endpoint is automatically exposed on /debug/pprof
92
- gocritic :
93
- enabled-tags :
94
- - experimental
95
- disabled-checks :
96
- - appendAssign
97
- - dupImport # https://github.com/go-critic/go-critic/issues/845
98
- - evalOrder
99
- - ifElseChain
100
- - octalLiteral
101
- - regexpSimplify
102
- - sloppyReassign
103
- - truncateCmp
104
- - typeDefFirst
105
- - unnamedResult
106
- - unnecessaryDefer
107
- - whyNoLint
108
- - wrapperFunc
109
- unused :
110
- go : " 1.24"
41
+ settings :
42
+ gocritic :
43
+ disabled-checks :
44
+ - appendAssign
45
+ - dupImport
46
+ - evalOrder
47
+ - ifElseChain
48
+ - octalLiteral
49
+ - regexpSimplify
50
+ - sloppyReassign
51
+ - truncateCmp
52
+ - typeDefFirst
53
+ - unnamedResult
54
+ - unnecessaryDefer
55
+ - whyNoLint
56
+ - wrapperFunc
57
+ enabled-tags :
58
+ - experimental
59
+ gocyclo :
60
+ min-complexity : 20
61
+ godot :
62
+ scope : toplevel
63
+ exclude :
64
+ - ^ \+.*
65
+ - ^ ANCHOR.*
66
+ gosec :
67
+ excludes :
68
+ - G307
69
+ - G108
70
+ staticcheck :
71
+ checks :
72
+ - all
73
+ # QF1006: could lift into loop condition
74
+ - -QF1006
75
+ # QF1007: could merge conditional assignment into variable declaration
76
+ - -QF1007
77
+ # QF1008 could remove embedded field from selector
78
+ - -QF1008
79
+ # ST1001: should not use dot imports
80
+ - -ST1001
81
+ importas :
82
+ alias :
83
+ - pkg : k8s.io/api/core/v1
84
+ alias : corev1
85
+ - pkg : k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1
86
+ alias : apiextensionsv1
87
+ - pkg : k8s.io/apimachinery/pkg/apis/meta/v1
88
+ alias : metav1
89
+ - pkg : k8s.io/apimachinery/pkg/api/errors
90
+ alias : apierrors
91
+ - pkg : k8s.io/apimachinery/pkg/util/errors
92
+ alias : kerrors
93
+ - pkg : sigs.k8s.io/controller-runtime
94
+ alias : ctrl
95
+ no-unaliased : true
96
+ nolintlint :
97
+ require-specific : true
98
+ allow-unused : false
99
+ exclusions :
100
+ generated : lax
101
+ rules :
102
+ - linters :
103
+ - revive
104
+ text : ' exported: exported method .*\.(Reconcile|SetupWithManager|SetupWebhookWithManager) should have comment or be unexported'
105
+ - linters :
106
+ - errcheck
107
+ text : Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
108
+ - linters :
109
+ - revive
110
+ text : exported (method|function|type|const) (.+) should have comment or be unexported
111
+ source : (func|type).*Fake.*
112
+ - linters :
113
+ - revive
114
+ path : fake_\.go
115
+ text : exported (method|function|type|const) (.+) should have comment or be unexported
116
+ - linters :
117
+ - revive
118
+ path : (framework|e2e)/.*.go
119
+ text : exported (method|function|type|const) (.+) should have comment or be unexported
120
+ - linters :
121
+ - unparam
122
+ text : always receives
123
+ - path : _test\.go
124
+ text : should not use dot imports
125
+ - path : (framework|e2e)/.*.go
126
+ text : should not use dot imports
127
+ - path : _test\.go
128
+ text : cyclomatic complexity
129
+ - linters :
130
+ - gocritic
131
+ text : ' appendAssign: append result not assigned to the same slice'
132
+ - linters :
133
+ - staticcheck
134
+ path : .*(api|types)\/.*\/.*conversion.*\.go$
135
+ text : ' SA1019: in.(.+) is deprecated'
136
+ - linters :
137
+ - revive
138
+ path : .*(api|types)\/.*\/.*conversion.*\.go$
139
+ text : exported (method|function|type|const) (.+) should have comment or be unexported
140
+ - linters :
141
+ - revive
142
+ path : .*(api|types)\/.*\/.*conversion.*\.go$
143
+ text : ' var-naming: don'' t use underscores in Go names;'
144
+ - linters :
145
+ - revive
146
+ path : .*(api|types)\/.*\/.*conversion.*\.go$
147
+ text : ' receiver-naming: receiver name'
148
+ - linters :
149
+ - staticcheck
150
+ path : .*(api|types)\/.*\/.*conversion.*\.go$
151
+ text : ' ST1003: should not use underscores in Go names;'
152
+ - linters :
153
+ - staticcheck
154
+ path : .*(api|types)\/.*\/.*conversion.*\.go$
155
+ text : ' ST1016: methods on the same type should have the same receiver name'
156
+ - linters :
157
+ - gocritic
158
+ path : _test\.go
159
+ text : ' deferInLoop: Possible resource leak, '' defer'' is called in the '' for'' loop'
160
+ paths :
161
+ - zz_generated.*\.go$
162
+ - third_party$
163
+ - builtin$
164
+ - examples$
111
165
issues :
112
- exclude-files :
113
- - " zz_generated.*\\ .go$"
114
- max-same-issues : 0
115
166
max-issues-per-linter : 0
116
- # We are disabling default golangci exclusions because we want to help reviewers to focus on reviewing the most relevant
117
- # changes in PRs and avoid nitpicking.
118
- exclude-use-default : false
119
- exclude-rules :
120
- - linters :
121
- - gci
122
- path : _test\.go
123
- - linters :
124
- - revive
125
- text : " exported: exported method .*\\ .(Reconcile|SetupWithManager|SetupWebhookWithManager) should have comment or be unexported"
126
- - linters :
127
- - errcheck
128
- text : Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
129
- # Exclude some packages or code to require comments, for example test code, or fake clients.
130
- - linters :
131
- - revive
132
- text : exported (method|function|type|const) (.+) should have comment or be unexported
133
- source : (func|type).*Fake.*
134
- - linters :
135
- - revive
136
- text : exported (method|function|type|const) (.+) should have comment or be unexported
137
- path : fake_\.go
138
- - linters :
139
- - revive
140
- text : exported (method|function|type|const) (.+) should have comment or be unexported
141
- path : " (framework|e2e)/.*.go"
142
- # Disable unparam "always receives" which might not be really
143
- # useful when building libraries.
144
- - linters :
145
- - unparam
146
- text : always receives
147
- # Dot imports for gomega or ginkgo are allowed
148
- # within test files.
149
- - path : _test\.go
150
- text : should not use dot imports
151
- - path : (framework|e2e)/.*.go
152
- text : should not use dot imports
153
- - path : _test\.go
154
- text : cyclomatic complexity
155
- # Append should be able to assign to a different var/slice.
156
- - linters :
157
- - gocritic
158
- text : " appendAssign: append result not assigned to the same slice"
159
- # Disable linters for conversion
160
- - linters :
161
- - staticcheck
162
- text : " SA1019: in.(.+) is deprecated"
163
- path : .*(api|types)\/.*\/.*conversion.*\.go$
164
- - linters :
165
- - revive
166
- text : exported (method|function|type|const) (.+) should have comment or be unexported
167
- path : .*(api|types)\/.*\/.*conversion.*\.go$
168
- - linters :
169
- - revive
170
- text : " var-naming: don't use underscores in Go names;"
171
- path : .*(api|types)\/.*\/.*conversion.*\.go$
172
- - linters :
173
- - revive
174
- text : " receiver-naming: receiver name"
175
- path : .*(api|types)\/.*\/.*conversion.*\.go$
176
- - linters :
177
- - stylecheck
178
- text : " ST1003: should not use underscores in Go names;"
179
- path : .*(api|types)\/.*\/.*conversion.*\.go$
180
- - linters :
181
- - stylecheck
182
- text : " ST1016: methods on the same type should have the same receiver name"
183
- path : .*(api|types)\/.*\/.*conversion.*\.go$
184
- # hack/tools
185
- - linters :
186
- - typecheck
187
- text : import (".+") is a program, not an importable package
188
- path : ^tools\.go$
189
- # We don't care about defer in for loops in test files.
190
- - linters :
191
- - gocritic
192
- text : " deferInLoop: Possible resource leak, 'defer' is called in the 'for' loop"
193
- path : _test\.go
194
-
195
- run :
196
- timeout : 10m
197
- build-tags :
198
- - tools
199
- - e2e
200
- allow-parallel-runners : true
201
- go : " 1.24"
167
+ max-same-issues : 0
168
+ formatters :
169
+ enable :
170
+ - gofmt
171
+ - goimports
172
+ settings :
173
+ gci :
174
+ sections :
175
+ - standard
176
+ - default
177
+ - prefix(github.com/IBM)
178
+ - prefix(k8s.io)
179
+ - prefix(sigs.k8s.io)
180
+ - blank
181
+ - dot
182
+ exclusions :
183
+ generated : lax
184
+ paths :
185
+ - zz_generated.*\.go$
186
+ - third_party$
187
+ - builtin$
188
+ - examples$
189
+ - _test\.go
0 commit comments