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,134 @@ 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
+ - name : blank-imports
64
+ - name : context-as-argument
65
+ - name : context-keys-type
66
+ - name : dot-imports
67
+ - name : error-return
68
+ - name : error-strings
69
+ - name : error-naming
70
+ - name : exported
71
+ - name : if-return
72
+ - name : increment-decrement
73
+ - name : var-naming
74
+ - name : var-declaration
75
+ - name : range
76
+ - name : receiver-naming
77
+ - name : time-naming
78
+ - name : unexported-return
79
+ - name : indent-error-flow
80
+ - name : errorf
81
+ - name : superfluous-else
82
+ - name : unreachable-code
83
+ - name : redefines-builtin-id
84
+ - name : bool-literal-in-expr
85
+ - name : constant-logical-expr
86
+ exclusions :
87
+ generated : lax
66
88
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
-
89
+ - linters :
90
+ - gosec
91
+ text : ' G108: Profiling endpoint is automatically exposed on /debug/pprof'
92
+ - linters :
93
+ - revive
94
+ text : ' exported: exported method .*\.(Reconcile|SetupWithManager|SetupWebhookWithManager) should have comment or be unexported'
95
+ - linters :
96
+ - errcheck
97
+ text : Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
98
+ - linters :
99
+ - staticcheck
100
+ text : ' SA1019: .*The component config package has been deprecated and will be removed in a future release.'
101
+ - linters :
102
+ - revive
103
+ source : _ "embed"
104
+ - linters :
105
+ - revive
106
+ text : exported (method|function|type|const) (.+) should have comment or be unexported
107
+ source : (func|type).*Fake.*
108
+ - linters :
109
+ - revive
110
+ path : fake_\.go
111
+ text : exported (method|function|type|const) (.+) should have comment or be unexported
112
+ - linters :
113
+ - unparam
114
+ text : always receives
115
+ - path : _test\.go
116
+ text : should not use dot imports
117
+ - path : _test\.go
118
+ text : cyclomatic complexity
119
+ - path : _test\.go
120
+ text : ' G107: Potential HTTP request made with variable url'
121
+ - linters :
122
+ - gocritic
123
+ text : ' appendAssign: append result not assigned to the same slice'
124
+ - linters :
125
+ - gocritic
126
+ text : ' singleCaseSwitch: should rewrite switch statement to if statement'
127
+ - linters :
128
+ - gosec
129
+ text : ' G304: Potential file inclusion via variable'
130
+ - linters :
131
+ - dupl
132
+ path : _test\.go
133
+ - linters :
134
+ - revive
135
+ path : .*/internal/.*
136
+ - linters :
137
+ - unused
138
+ path : pkg/controller/priorityqueue/metrics\.go
139
+ - path : (.+)\.go$
140
+ text : Subprocess launch(ed with variable|ing should be audited)
141
+ - path : (.+)\.go$
142
+ text : (G204|G104|G307)
143
+ - path : (.+)\.go$
144
+ text : ' ST1000: at least one file in a package should have a package comment'
145
+ paths :
146
+ - zz_generated.*\.go$
147
+ - .*conversion.*\.go$
148
+ - third_party$
149
+ - builtin$
150
+ - examples$
95
151
issues :
96
- max-same-issues : 0
97
152
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
153
+ max-same-issues : 0
154
+ formatters :
155
+ enable :
156
+ - gofmt
157
+ - goimports
158
+ exclusions :
159
+ generated : lax
160
+ paths :
161
+ - zz_generated.*\.go$
162
+ - .*conversion.*\.go$
163
+ - third_party$
164
+ - builtin$
165
+ - examples$
0 commit comments