talos
/
.golangci.yml
430 строк · 12.8 Кб
1# This file contains all available configuration options
2# with their default values.
3
4# options for analysis running
5run:
6# default concurrency is a available CPU number
7# concurrency: 4
8
9# timeout for analysis, e.g. 30s, 5m, default is 1m
10timeout: 10m
11
12# exit code when at least one issue was found, default is 1
13issues-exit-code: 1
14
15# include test files or not, default is true
16tests: true
17
18# list of build tags, all linters use it. Default is empty list.
19build-tags:
20- integration
21- integration_api
22- integration_cli
23- integration_k8s
24- integration_provision
25
26# output configuration options
27output:
28# colored-line-number|line-number|json|tab|checkstyle, default is "colored-line-number"
29formats:
30- format: line-number
31path: stdout
32print-issued-lines: true
33print-linter-name: true
34uniq-by-line: true
35sort-results: true
36
37# all available settings of specific linters
38linters-settings:
39errcheck:
40# report about not checking of errors in type assetions: `a := b.(MyStruct)`;
41# default is false: such cases aren't reported by default.
42check-type-assertions: true
43
44# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
45# default is false: such cases aren't reported by default.
46check-blank: true
47
48exclude-functions:
49- fmt.Fprintln
50- fmt.Fprintf
51- fmt.Fprint
52govet: { }
53gocyclo:
54# minimal code complexity to report, 30 by default (but we recommend 10-20)
55min-complexity: 10
56dupl:
57# tokens count to trigger issue, 150 by default
58threshold: 100
59goconst:
60# minimal length of string constant, 3 by default
61min-len: 3
62# minimal occurrences count to trigger, 3 by default
63min-occurrences: 3
64misspell:
65# Correct spellings using locale preferences for US or UK.
66# Default is to use a neutral variety of English.
67# Setting locale to US will correct the British spelling of 'colour' to 'color'.
68locale: US
69lll:
70# max line length, lines longer will be reported. Default is 120.
71# '\t' is counted as 1 character by default, and can be changed with the tab-width option
72line-length: 200
73# tab width in spaces. Default to 1.
74tab-width: 1
75nolintlint:
76allow-unused: false
77allow-no-explanation: []
78require-explanation: false
79require-specific: true
80unused:
81local-variables-are-used: false
82prealloc:
83# XXX: we don't recommend using this linter before doing performance profiling.
84# For most programs usage of prealloc will be a premature optimization.
85
86# Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
87# True by default.
88simple: true
89range-loops: true # Report preallocation suggestions on range loops, true by default
90for-loops: false # Report preallocation suggestions on for loops, false by default
91gci:
92sections:
93- standard # Captures all standard packages if they do not match another section.
94- default # Contains all imports that could not be matched to another section type.
95- prefix(github.com/siderolabs/talos) # Groups all imports with the specified Prefix.
96cyclop:
97# the maximal code complexity to report
98max-complexity: 20
99gomoddirectives:
100replace-local: true
101replace-allow-list:
102- gopkg.in/yaml.v3
103- github.com/coredns/coredns
104- github.com/mdlayher/kobject
105- golang.zx2c4.com/wireguard
106- golang.zx2c4.com/wireguard/wgctrl
107retract-allow-no-explanation: false
108exclude-forbidden: false
109
110linters:
111enable-all: true
112disable:
113- errorlint
114- err113
115- exhaustruct
116- forbidigo
117- forcetypeassert
118- funlen
119- gochecknoglobals
120- gochecknoinits
121- gocognit
122- godox
123- gomnd
124- gosec
125- ireturn # we return interfaces
126- maintidx
127- mnd
128- nestif
129- nilnil # we return "nil, nil"
130- nonamedreturns
131- paralleltest
132- promlinter # https://github.com/golangci/golangci-lint/issues/2222
133- tagliatelle # we have many different conventions
134- thelper
135- varnamelen # too annoying
136- wrapcheck
137- contextcheck # enable once golangci-lint 1.50.1 or 1.51 lands
138- dupword # too annoying
139- musttag # too annoying
140- nakedret # too annoying
141- depguard
142- tagalign # too annoying
143- testifylint # too annoying
144- inamedparam # too annoying
145- protogetter # too annoying
146- perfsprint
147disable-all: false
148fast: false
149
150issues:
151# List of regexps of issue texts to exclude, empty list by default.
152# But independently from this option we use default exclude patterns,
153# it can be disabled by `exclude-use-default: false`. To list all
154# excluded by default patterns execute `golangci-lint run --help`
155exclude:
156- package comment should be of the form "Package services ..." # revive
157- ^ST1000 # ST1000: at least one file in a package should have a package comment (stylecheck)
158- parameter '\w+' seems to be unused, consider removing or renaming it as _ # noisy check, especially when the usage is an interface implementation
159
160exclude-files:
161- .*\\.pb\\.go$
162
163exclude-rules:
164- path: cmd/talosctl/cmd
165linters:
166- dupl
167- path: internal/app/machined/internal/phase
168linters:
169- dupl
170- path: internal/app/machined/pkg/system/services
171linters:
172- dupl
173- path: cmd/talosctl/cmd/mgmt
174text: "should have a package comment"
175linters:
176- revive
177- path: cmd/talosctl/cmd/mgmt/inject
178text: "should have a package comment"
179linters:
180- revive
181- path: cmd/talosctl/cmd/talos
182text: "should have a package comment"
183linters:
184- revive
185- path: cmd/talosctl/pkg/talos/action
186text: "should have a package comment"
187linters:
188- revive
189- path: cmd/talosctl/pkg/talos/global
190text: "should have a package comment"
191linters:
192- revive
193- path: cmd/talosctl/pkg/talos/helpers
194text: "should have a package comment"
195linters:
196- revive
197- path: internal/app/machined/pkg/controllers/cri
198text: "should have a package comment"
199linters:
200- revive
201- path: internal/app/machined/pkg/controllers/kubeaccess/serviceaccount
202text: "should have a package comment"
203linters:
204- revive
205- path: internal/app/machined/pkg/controllers/perf
206text: "should have a package comment"
207linters:
208- revive
209- path: internal/app/machined/pkg/system/events
210text: "should have a package comment"
211linters:
212- revive
213- path: internal/app/machined/pkg/system/health
214text: "should have a package comment"
215linters:
216- revive
217- path: internal/app/machined/pkg/system/runner/containerd
218text: "should have a package comment"
219linters:
220- revive
221- path: internal/app/machined/pkg/system/runner/goroutine
222text: "should have a package comment"
223linters:
224- revive
225- path: internal/app/machined/pkg/system/runner/process
226text: "should have a package comment"
227linters:
228- revive
229- path: internal/app/machined/pkg/system/runner/restart
230text: "should have a package comment"
231linters:
232- revive
233- path: internal/app/machined/pkg/system
234text: "should have a package comment"
235linters:
236- revive
237- path: internal/app/maintenance
238text: "should have a package comment"
239linters:
240- revive
241- path: internal/app/maintenance/server
242text: "should have a package comment"
243linters:
244- revive
245- path: internal/app/poweroff
246text: "should have a package comment"
247linters:
248- revive
249- path: internal/app/trustd/internal/reg
250text: "should have a package comment"
251linters:
252- revive
253- path: internal/app/trustd
254text: "should have a package comment"
255linters:
256- revive
257- path: internal/pkg/containers/image
258text: "should have a package comment"
259linters:
260- revive
261- path: internal/pkg/etcd
262text: "should have a package comment"
263linters:
264- revive
265- path: internal/pkg/install
266text: "should have a package comment"
267linters:
268- revive
269- path: internal/pkg/mount
270text: "should have a package comment"
271linters:
272- revive
273- path: internal/pkg/mount/switchroot
274text: "should have a package comment"
275linters:
276- revive
277- path: internal/pkg/tui/components
278text: "should have a package comment"
279linters:
280- revive
281- path: pkg/argsbuilder
282text: "should have a package comment"
283linters:
284- revive
285- path: pkg/chunker
286text: "should have a package comment"
287linters:
288- revive
289- path: pkg/chunker/file
290text: "should have a package comment"
291linters:
292- revive
293- path: pkg/chunker/stream
294text: "should have a package comment"
295linters:
296- revive
297- path: pkg/download
298text: "should have a package comment"
299linters:
300- revive
301- path: pkg/grpc/dialer
302text: "should have a package comment"
303linters:
304- revive
305- path: pkg/grpc/factory
306text: "should have a package comment"
307linters:
308- revive
309- path: pkg/grpc/gen
310text: "should have a package comment"
311linters:
312- revive
313- path: pkg/grpc/middleware/auth/basic
314text: "should have a package comment"
315linters:
316- revive
317- path: pkg/grpc/middleware/authz
318text: "should have a package comment"
319linters:
320- revive
321- path: pkg/kubernetes
322text: "should have a package comment"
323linters:
324- revive
325- path: pkg/kubernetes/inject
326text: "should have a package comment"
327linters:
328- revive
329- path: pkg/provision/providers
330text: "should have a package comment"
331linters:
332- revive
333- path: pkg/provision/providers/qemu
334text: "should have a package comment"
335linters:
336- revive
337- path: config/encoder
338text: "should have a package comment"
339linters:
340- revive
341- path: resources/kubespan
342text: "should have a package comment"
343linters:
344- revive
345- path: client/config
346text: "should have a package comment"
347linters:
348- revive
349- path: config/merge
350text: "should have a package comment"
351linters:
352- revive
353- path: config/types/v1alpha1/bundle
354text: "should have a package comment"
355linters:
356- revive
357- path: resources/cri
358text: "should have a package comment"
359linters:
360- revive
361- path: resources/runtime
362text: "should have a package comment"
363linters:
364- revive
365- path: kernel
366text: "should have a package comment"
367linters:
368- revive
369- path: constants
370text: "should have a package comment"
371linters:
372- revive
373- path: resources/perf
374text: "should have a package comment"
375linters:
376- revive
377- path: resources/cluster
378text: "should have a package comment"
379linters:
380- revive
381- path: role
382text: "should have a package comment"
383linters:
384- revive
385- path: resources/hardware
386text: "should have a package comment"
387linters:
388- revive
389- path: config/decoder
390text: "should have a package comment"
391linters:
392- revive
393- path: config/internal/cis
394text: "should have a package comment"
395linters:
396- revive
397- path: config/types/v1alpha1/machine
398text: "should have a package comment"
399linters:
400- revive
401
402# pkg/machinery module
403- path: config/types/v1alpha1
404linters:
405- dupl # some interfaces and implementation are nearly identical (e.g. APIServer, ControllerManager, and Scheduler)
406
407# unused going into opencontainers repo (?)
408- path: specs-go/config.go
409linters:
410- unused
411
412# Independently from option `exclude` we use default exclude patterns,
413# it can be disabled by this option. To list all
414# excluded by default patterns execute `golangci-lint run --help`.
415# Default value for this option is true.
416exclude-use-default: false
417
418# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
419max-issues-per-linter: 0
420
421# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
422max-same-issues: 0
423
424# Show only new issues: if there are unstaged changes or untracked files,
425# only those changes are analyzed, else only changes in HEAD~ are analyzed.
426# It's a super-useful option for integration of golangci-lint into existing
427# large codebase. It's not practical to fix all existing issues at the moment
428# of integration: much better don't allow issues in new code.
429# Default is false.
430new: false
431