1- # Copyright 2024 StreamNative
1+ # Copyright 2025 StreamNative
22#
33# Licensed under the Apache License, Version 2.0 (the "License");
44# you may not use this file except in compliance with the License.
1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15+ version : " 2"
16+
17+ run :
18+ go : " 1.24"
19+ build-tags :
20+ - tools
21+ - e2e
22+ allow-parallel-runners : true
23+
1524linters :
16- disable-all : true
25+ default : none
1726 enable :
1827 - asciicheck
1928 - bodyclose
20- - unused
21- # - deadcode
22- # - depguard
29+ - copyloopvar
2330 - dogsled
2431 - errcheck
25- - copyloopvar
26- # - gci
2732 - gocritic
28- # - gocyclo
29- # - godot
30- - gofmt
31- - goimports
3233 - goprintffuncname
3334 - gosec
34- - gosimple
3535 - govet
3636 - importas
3737 - ineffassign
@@ -43,166 +43,148 @@ linters:
4343 - predeclared
4444 - rowserrcheck
4545 - staticcheck
46- # - structcheck
47- - stylecheck
4846 - thelper
49- - typecheck
5047 - unconvert
5148 - unparam
52- # - varcheck
53-
54- linters-settings :
55- godot :
56- # declarations - for top level declaration comments (default);
57- # toplevel - for top level comments;
58- # all - for all comments.
59- scope : toplevel
60- exclude :
61- - ' ^ \+.*'
62- - " ^ ANCHOR.*"
63- gci :
64- sections :
65- - prefix(github.com/streamnative)
49+ - unused
50+ settings :
51+ gocritic :
52+ disabled-checks :
53+ - appendAssign
54+ - dupImport
55+ - evalOrder
56+ - ifElseChain
57+ - octalLiteral
58+ - regexpSimplify
59+ - sloppyReassign
60+ - truncateCmp
61+ - typeDefFirst
62+ - unnamedResult
63+ - unnecessaryDefer
64+ - whyNoLint
65+ - wrapperFunc
66+ enabled-tags :
67+ - experimental
68+ godot :
69+ scope : toplevel
70+ exclude :
71+ - ^ \+.*
72+ - ^ ANCHOR.*
73+ gosec :
74+ excludes :
75+ - G307
76+ - G108
77+ importas :
78+ alias :
79+ - pkg : k8s.io/api/core/v1
80+ alias : corev1
81+ - pkg : k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1
82+ alias : apiextensionsv1
83+ - pkg : k8s.io/apimachinery/pkg/apis/meta/v1
84+ alias : metav1
85+ - pkg : k8s.io/apimachinery/pkg/api/errors
86+ alias : apierrors
87+ - pkg : k8s.io/apimachinery/pkg/util/errors
88+ alias : kerrors
89+ - pkg : sigs.k8s.io/controller-runtime
90+ alias : ctrl
91+ no-unaliased : true
92+ nolintlint :
93+ require-specific : true
94+ allow-unused : false
95+ exclusions :
96+ generated : lax
97+ rules :
98+ - linters :
99+ - revive
100+ text : ' exported: exported method .*\.(Reconcile|SetupWithManager|SetupWebhookWithManager) should have comment or be unexported'
101+ - linters :
102+ - errcheck
103+ text : Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
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+ - revive
114+ path : cmd/clusterctl/internal/test/providers.*.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+ - ifshort
134+ path : controllers/mdutil/util.go
135+ text : variable .* is only used in the if-statement
136+ - linters :
137+ - staticcheck
138+ path : .*(api|types)\/.*\/conversion.*\.go$
139+ text : ' SA1019: in.(.+) is deprecated'
140+ - linters :
141+ - revive
142+ path : .*(api|types)\/.*\/conversion.*\.go$
143+ text : exported (method|function|type|const) (.+) should have comment or be unexported
144+ - linters :
145+ - revive
146+ path : .*(api|types)\/.*\/conversion.*\.go$
147+ text : ' var-naming: don'' t use underscores in Go names;'
148+ - linters :
149+ - revive
150+ path : .*(api|types)\/.*\/conversion.*\.go$
151+ text : ' receiver-naming: receiver name'
152+ - linters :
153+ - staticcheck
154+ path : .*(api|types)\/.*\/conversion.*\.go$
155+ text : ' ST1003: should not use underscores in Go names;'
156+ - linters :
157+ - staticcheck
158+ path : .*(api|types)\/.*\/conversion.*\.go$
159+ text : ' ST1016: methods on the same type should have the same receiver name'
160+ - linters :
161+ - ifshort
162+ path : ^controllers/machine_controller\.go$
163+ text : variable 'isDeleteNodeAllowed' is only used in the if-statement.*
164+ paths :
165+ - zz_generated.*\.go$
166+ - third_party
167+ - third_party$
168+ - builtin$
169+ - examples$
66170
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- require-specific : true
87- gosec :
88- excludes :
89- - G307 # Deferring unsafe method "Close" on type "\*os.File"
90- - G108 # Profiling endpoint is automatically exposed on /debug/pprof
91- gocritic :
92- enabled-tags :
93- - experimental
94- disabled-checks :
95- - appendAssign
96- - dupImport # https://github.com/go-critic/go-critic/issues/845
97- - evalOrder
98- - ifElseChain
99- - octalLiteral
100- - regexpSimplify
101- - sloppyReassign
102- - truncateCmp
103- - typeDefFirst
104- - unnamedResult
105- - unnecessaryDefer
106- - whyNoLint
107- - wrapperFunc
108171issues :
109- max-same-issues : 0
110172 max-issues-per-linter : 0
111- # We are disabling default golangci exclusions because we want to help reviewers to focus on reviewing the most relevant
112- # changes in PRs and avoid nitpicking.
113- exclude-use-default : false
114- exclude-files :
115- - " zz_generated.*\\ .go$"
116- exclude-dirs :
117- - third_party
118- exclude-rules :
119- - linters :
120- - revive
121- text : " exported: exported method .*\\ .(Reconcile|SetupWithManager|SetupWebhookWithManager) should have comment or be unexported"
122- - linters :
123- - errcheck
124- text : Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
125- # Exclude some packages or code to require comments, for example test code, or fake clients.
126- - linters :
127- - revive
128- text : exported (method|function|type|const) (.+) should have comment or be unexported
129- source : (func|type).*Fake.*
130- - linters :
131- - revive
132- text : exported (method|function|type|const) (.+) should have comment or be unexported
133- path : fake_\.go
134- - linters :
135- - revive
136- text : exported (method|function|type|const) (.+) should have comment or be unexported
137- path : cmd/clusterctl/internal/test/providers.*.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- # ifshort flags variables that are only used in the if-statement even though there is
160- # already a SimpleStmt being used in the if-statement in question.
161- - linters :
162- - ifshort
163- text : " variable .* is only used in the if-statement"
164- path : controllers/mdutil/util.go
165- # Disable linters for conversion
166- - linters :
167- - staticcheck
168- text : " SA1019: in.(.+) is deprecated"
169- path : .*(api|types)\/.*\/conversion.*\.go$
170- - linters :
171- - revive
172- text : exported (method|function|type|const) (.+) should have comment or be unexported
173- path : .*(api|types)\/.*\/conversion.*\.go$
174- - linters :
175- - revive
176- text : " var-naming: don't use underscores in Go names;"
177- path : .*(api|types)\/.*\/conversion.*\.go$
178- - linters :
179- - revive
180- text : " receiver-naming: receiver name"
181- path : .*(api|types)\/.*\/conversion.*\.go$
182- - linters :
183- - stylecheck
184- text : " ST1003: should not use underscores in Go names;"
185- path : .*(api|types)\/.*\/conversion.*\.go$
186- - linters :
187- - stylecheck
188- text : " ST1016: methods on the same type should have the same receiver name"
189- path : .*(api|types)\/.*\/conversion.*\.go$
190- # hack/tools
191- - linters :
192- - typecheck
193- text : import (".+") is a program, not an importable package
194- path : ^tools\.go$
195- # Ignore ifshort false positive
196- # TODO(sbueringer) false positive: https://github.com/esimonov/ifshort/issues/23
197- - linters :
198- - ifshort
199- text : " variable 'isDeleteNodeAllowed' is only used in the if-statement.*"
200- path : ^controllers/machine_controller\.go$
173+ max-same-issues : 0
201174
202- run :
203- timeout : 10m
204- build-tags :
205- - tools
206- - e2e
207- allow-parallel-runners : true
208- go : " 1.24"
175+ formatters :
176+ enable :
177+ - gofmt
178+ - goimports
179+ settings :
180+ gci :
181+ sections :
182+ - prefix(github.com/streamnative)
183+ exclusions :
184+ generated : lax
185+ paths :
186+ - zz_generated.*\.go$
187+ - third_party
188+ - third_party$
189+ - builtin$
190+ - examples$
0 commit comments