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