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