1
+ version : " 2"
2
+ run :
3
+ go : " 1.23"
4
+ allow-parallel-runners : true
1
5
linters :
2
- disable-all : true
6
+ default : none
3
7
enable :
4
8
- asasalint
5
9
- asciicheck
@@ -12,15 +16,11 @@ linters:
12
16
- errchkjson
13
17
- errorlint
14
18
- exhaustive
15
- - gci
16
19
- ginkgolinter
17
20
- goconst
18
21
- gocritic
19
22
- gocyclo
20
- - gofmt
21
- - goimports
22
23
- goprintffuncname
23
- - gosimple
24
24
- govet
25
25
- importas
26
26
- ineffassign
@@ -32,161 +32,163 @@ linters:
32
32
- prealloc
33
33
- revive
34
34
- staticcheck
35
- - stylecheck
36
35
- tagliatelle
37
- - typecheck
38
36
- unconvert
39
37
- unparam
40
38
- unused
41
39
- whitespace
42
-
43
- linters-settings :
44
- govet :
45
- enable-all : true
46
- disable :
47
- - fieldalignment
48
- - shadow
49
- gci :
50
- custom-order : true
51
- skip-generated : true
52
- sections :
53
- - standard
54
- - default
55
- - prefix(k8s.io)
56
- - prefix(sigs.k8s.io/controller-runtime)
57
- - prefix(sigs.k8s.io/multicluster-runtime)
58
- - blank
59
- - dot
60
- importas :
61
- no-unaliased : true
62
- alias :
63
- # Kubernetes
64
- - pkg : k8s.io/api/core/v1
65
- alias : corev1
66
- - pkg : k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1
67
- alias : apiextensionsv1
68
- - pkg : k8s.io/apimachinery/pkg/apis/meta/v1
69
- alias : metav1
70
- - pkg : k8s.io/apimachinery/pkg/api/errors
71
- alias : apierrors
72
- - pkg : k8s.io/apimachinery/pkg/util/errors
73
- alias : kerrors
74
- # Controller Runtime
75
- - pkg : sigs.k8s.io/controller-runtime
76
- alias : ctrl
77
- revive :
78
- rules :
40
+ settings :
41
+ govet :
42
+ disable :
43
+ - fieldalignment
44
+ - shadow
45
+ enable-all : true
46
+ importas :
47
+ alias :
48
+ # Kubernetes
49
+ - pkg : k8s.io/api/core/v1
50
+ alias : corev1
51
+ - pkg : k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1
52
+ alias : apiextensionsv1
53
+ - pkg : k8s.io/apimachinery/pkg/apis/meta/v1
54
+ alias : metav1
55
+ - pkg : k8s.io/apimachinery/pkg/api/errors
56
+ alias : apierrors
57
+ - pkg : k8s.io/apimachinery/pkg/util/errors
58
+ alias : kerrors
59
+ # Controller Runtime
60
+ - pkg : sigs.k8s.io/controller-runtime
61
+ alias : ctrl
62
+ no-unaliased : true
63
+ revive :
79
64
# The following rules are recommended https://github.com/mgechev/revive#recommended-configuration
80
- - name : blank-imports
81
- - name : context-as-argument
82
- - name : context-keys-type
83
- - name : dot-imports
84
- - name : error-return
85
- - name : error-strings
86
- - name : error-naming
87
- - name : exported
88
- - name : if-return
89
- - name : increment-decrement
90
- - name : var-naming
91
- - name : var-declaration
92
- - name : range
93
- - name : receiver-naming
94
- - name : time-naming
95
- - name : unexported-return
96
- - name : indent-error-flow
97
- - name : errorf
98
- - name : superfluous-else
99
- - name : unreachable-code
100
- - name : redefines-builtin-id
101
- #
102
- # Rules in addition to the recommended configuration above.
103
- #
104
- - name : bool-literal-in-expr
105
- - name : constant-logical-expr
106
-
65
+ rules :
66
+ - name : blank-imports
67
+ - name : context-as-argument
68
+ - name : context-keys-type
69
+ - name : dot-imports
70
+ - name : error-return
71
+ - name : error-strings
72
+ - name : error-naming
73
+ - name : exported
74
+ - name : if-return
75
+ - name : increment-decrement
76
+ - name : var-naming
77
+ - name : var-declaration
78
+ - name : range
79
+ - name : receiver-naming
80
+ - name : time-naming
81
+ - name : unexported-return
82
+ - name : indent-error-flow
83
+ - name : errorf
84
+ - name : superfluous-else
85
+ - name : unreachable-code
86
+ - name : redefines-builtin-id
87
+ # Rules in addition to the recommended configuration above.
88
+ - name : bool-literal-in-expr
89
+ - name : constant-logical-expr
90
+ exclusions :
91
+ generated : lax
92
+ rules :
93
+ - linters :
94
+ - gosec
95
+ text : ' G108: Profiling endpoint is automatically exposed on /debug/pprof'
96
+ - linters :
97
+ - revive
98
+ text : ' exported: exported method .*\.(Reconcile|SetupWithManager|SetupWebhookWithManager) should have comment or be unexported'
99
+ - linters :
100
+ - errcheck
101
+ text : Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
102
+ - linters :
103
+ - staticcheck
104
+ text : ' SA1019: .*The component config package has been deprecated and will be removed in a future release.'
105
+ - linters :
106
+ - staticcheck
107
+ text : ' QF1008: could remove embedded field ".*" from selector'
108
+ # With Go 1.16, the new embed directive can be used with an un-named import,
109
+ # revive (previously, golint) only allows these to be imported in a main.go, which wouldn't work for us.
110
+ # This directive allows the embed package to be imported with an underscore everywhere.
111
+ - linters :
112
+ - revive
113
+ source : _ "embed"
114
+ # Exclude some packages or code to require comments, for example test code, or fake clients.
115
+ - linters :
116
+ - revive
117
+ text : exported (method|function|type|const) (.+) should have comment or be unexported
118
+ source : (func|type).*Fake.*
119
+ - linters :
120
+ - revive
121
+ path : fake_\.go
122
+ text : exported (method|function|type|const) (.+) should have comment or be unexported
123
+ # Disable unparam "always receives" which might not be really
124
+ # useful when building libraries.
125
+ - linters :
126
+ - unparam
127
+ text : always receives
128
+ # Dot imports for gomega and ginkgo are allowed
129
+ # within test files.
130
+ - path : _test\.go
131
+ text : should not use dot imports
132
+ - path : _test\.go
133
+ text : cyclomatic complexity
134
+ - path : _test\.go
135
+ text : ' G107: Potential HTTP request made with variable url'
136
+ # Append should be able to assign to a different var/slice.
137
+ - linters :
138
+ - gocritic
139
+ text : ' appendAssign: append result not assigned to the same slice'
140
+ - linters :
141
+ - gocritic
142
+ text : ' singleCaseSwitch: should rewrite switch statement to if statement'
143
+ # It considers all file access to a filename that comes from a variable problematic,
144
+ # which is naiv at best.
145
+ - linters :
146
+ - gosec
147
+ text : ' G304: Potential file inclusion via variable'
148
+ - linters :
149
+ - dupl
150
+ path : _test\.go
151
+ - linters :
152
+ - revive
153
+ path : .*/internal/.*
154
+ # The following are being worked on to remove their exclusion. This list should be reduced or go away all together over time.
155
+ # If it is decided they will not be addressed they should be moved above this comment.
156
+ - path : (.+)\.go$
157
+ text : Subprocess launch(ed with variable|ing should be audited)
158
+ - path : (.+)\.go$
159
+ text : (G204|G104|G307)
160
+ - path : (.+)\.go$
161
+ text : ' ST1000: at least one file in a package should have a package comment'
162
+ paths :
163
+ - zz_generated.*\.go$
164
+ - .*conversion.*\.go$
165
+ - third_party$
166
+ - builtin$
167
+ - examples$
107
168
issues :
108
- max-same-issues : 0
109
169
max-issues-per-linter : 0
110
- # We are disabling default golangci exclusions because we want to help reviewers to focus on reviewing the most relevant
111
- # changes in PRs and avoid nitpicking.
112
- exclude-use-default : false
113
- # List of regexps of issue texts to exclude, empty list by default.
114
- exclude :
115
- # The following are being worked on to remove their exclusion. This list should be reduced or go away all together over time.
116
- # If it is decided they will not be addressed they should be moved above this comment.
117
- - Subprocess launch(ed with variable|ing should be audited)
118
- - (G204|G104|G307)
119
- - " ST1000: at least one file in a package should have a package comment"
120
- exclude-files :
121
- - " zz_generated.*\\ .go$"
122
- - " .*conversion.*\\ .go$"
123
- exclude-rules :
124
- - linters :
125
- - gosec
126
- text : " G108: Profiling endpoint is automatically exposed on /debug/pprof"
127
- - linters :
128
- - revive
129
- text : " exported: exported method .*\\ .(Reconcile|SetupWithManager|SetupWebhookWithManager) should have comment or be unexported"
130
- - linters :
131
- - errcheck
132
- text : Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
133
- - linters :
134
- - staticcheck
135
- text : " SA1019: .*The component config package has been deprecated and will be removed in a future release."
136
- # With Go 1.16, the new embed directive can be used with an un-named import,
137
- # revive (previously, golint) only allows these to be imported in a main.go, which wouldn't work for us.
138
- # This directive allows the embed package to be imported with an underscore everywhere.
139
- - linters :
140
- - revive
141
- source : _ "embed"
142
- # Exclude some packages or code to require comments, for example test code, or fake clients.
143
- - linters :
144
- - revive
145
- text : exported (method|function|type|const) (.+) should have comment or be unexported
146
- source : (func|type).*Fake.*
147
- - linters :
148
- - revive
149
- text : exported (method|function|type|const) (.+) should have comment or be unexported
150
- path : fake_\.go
151
- # Disable unparam "always receives" which might not be really
152
- # useful when building libraries.
153
- - linters :
154
- - unparam
155
- text : always receives
156
- # Dot imports for gomega and ginkgo are allowed
157
- # within test files.
158
- - path : _test\.go
159
- text : should not use dot imports
160
- - path : _test\.go
161
- text : cyclomatic complexity
162
- - path : _test\.go
163
- text : " G107: Potential HTTP request made with variable url"
164
- # Append should be able to assign to a different var/slice.
165
- - linters :
166
- - gocritic
167
- text : " appendAssign: append result not assigned to the same slice"
168
- - linters :
169
- - gocritic
170
- text : " singleCaseSwitch: should rewrite switch statement to if statement"
171
- # It considers all file access to a filename that comes from a variable problematic,
172
- # which is naiv at best.
173
- - linters :
174
- - gosec
175
- text : " G304: Potential file inclusion via variable"
176
- - linters :
177
- - dupl
178
- path : _test\.go
179
- - linters :
180
- - revive
181
- path : .*/internal/.*
182
- - linters :
183
- - unused
184
- # Seems to incorrectly trigger on the two implementations that are only
185
- # used through an interface and not directly..?
186
- # Likely same issue as https://github.com/dominikh/go-tools/issues/1616
187
- path : pkg/controller/priorityqueue/metrics\.go
188
-
189
- run :
190
- go : " 1.23"
191
- timeout : 10m
192
- allow-parallel-runners : true
170
+ max-same-issues : 0
171
+ formatters :
172
+ enable :
173
+ - gci
174
+ - gofmt
175
+ - goimports
176
+ settings :
177
+ gci :
178
+ sections :
179
+ - standard
180
+ - default
181
+ - prefix(k8s.io)
182
+ - prefix(sigs.k8s.io/controller-runtime)
183
+ - prefix(sigs.k8s.io/multicluster-runtime)
184
+ - blank
185
+ - dot
186
+ custom-order : true
187
+ exclusions :
188
+ generated : lax
189
+ paths :
190
+ - zz_generated.*\.go$
191
+ - .*conversion.*\.go$
192
+ - third_party$
193
+ - builtin$
194
+ - examples$
0 commit comments