talos

Форк
0
/
.golangci.yml 
430 строк · 12.8 Кб
1
# This file contains all available configuration options
2
# with their default values.
3

4
# options for analysis running
5
run:
6
  # default concurrency is a available CPU number
7
  # concurrency: 4
8

9
  # timeout for analysis, e.g. 30s, 5m, default is 1m
10
  timeout: 10m
11

12
  # exit code when at least one issue was found, default is 1
13
  issues-exit-code: 1
14

15
  # include test files or not, default is true
16
  tests: true
17

18
  # list of build tags, all linters use it. Default is empty list.
19
  build-tags:
20
    - integration
21
    - integration_api
22
    - integration_cli
23
    - integration_k8s
24
    - integration_provision
25

26
# output configuration options
27
output:
28
  # colored-line-number|line-number|json|tab|checkstyle, default is "colored-line-number"
29
  formats:
30
    - format: line-number
31
      path: stdout
32
  print-issued-lines: true
33
  print-linter-name: true
34
  uniq-by-line: true
35
  sort-results: true
36

37
# all available settings of specific linters
38
linters-settings:
39
  errcheck:
40
    # report about not checking of errors in type assetions: `a := b.(MyStruct)`;
41
    # default is false: such cases aren't reported by default.
42
    check-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.
46
    check-blank: true
47

48
    exclude-functions:
49
      - fmt.Fprintln
50
      - fmt.Fprintf
51
      - fmt.Fprint
52
  govet: { }
53
  gocyclo:
54
    # minimal code complexity to report, 30 by default (but we recommend 10-20)
55
    min-complexity: 10
56
  dupl:
57
    # tokens count to trigger issue, 150 by default
58
    threshold: 100
59
  goconst:
60
    # minimal length of string constant, 3 by default
61
    min-len: 3
62
    # minimal occurrences count to trigger, 3 by default
63
    min-occurrences: 3
64
  misspell:
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'.
68
    locale: US
69
  lll:
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
72
    line-length: 200
73
    # tab width in spaces. Default to 1.
74
    tab-width: 1
75
  nolintlint:
76
    allow-unused: false
77
    allow-no-explanation: []
78
    require-explanation: false
79
    require-specific: true
80
  unused:
81
    local-variables-are-used: false
82
  prealloc:
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.
88
    simple: true
89
    range-loops: true # Report preallocation suggestions on range loops, true by default
90
    for-loops: false # Report preallocation suggestions on for loops, false by default
91
  gci:
92
    sections:
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.
96
  cyclop:
97
    # the maximal code complexity to report
98
    max-complexity: 20
99
  gomoddirectives:
100
    replace-local: true
101
    replace-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
107
    retract-allow-no-explanation: false
108
    exclude-forbidden: false
109

110
linters:
111
  enable-all: true
112
  disable:
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
147
  disable-all: false
148
  fast: false
149

150
issues:
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`
155
  exclude:
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

160
  exclude-files:
161
    - .*\\.pb\\.go$
162

163
  exclude-rules:
164
    - path: cmd/talosctl/cmd
165
      linters:
166
        - dupl
167
    - path: internal/app/machined/internal/phase
168
      linters:
169
        - dupl
170
    - path: internal/app/machined/pkg/system/services
171
      linters:
172
        - dupl
173
    - path: cmd/talosctl/cmd/mgmt
174
      text: "should have a package comment"
175
      linters:
176
        - revive
177
    - path: cmd/talosctl/cmd/mgmt/inject
178
      text: "should have a package comment"
179
      linters:
180
        - revive
181
    - path: cmd/talosctl/cmd/talos
182
      text: "should have a package comment"
183
      linters:
184
        - revive
185
    - path: cmd/talosctl/pkg/talos/action
186
      text: "should have a package comment"
187
      linters:
188
        - revive
189
    - path: cmd/talosctl/pkg/talos/global
190
      text: "should have a package comment"
191
      linters:
192
        - revive
193
    - path: cmd/talosctl/pkg/talos/helpers
194
      text: "should have a package comment"
195
      linters:
196
        - revive
197
    - path: internal/app/machined/pkg/controllers/cri
198
      text: "should have a package comment"
199
      linters:
200
        - revive
201
    - path: internal/app/machined/pkg/controllers/kubeaccess/serviceaccount
202
      text: "should have a package comment"
203
      linters:
204
        - revive
205
    - path: internal/app/machined/pkg/controllers/perf
206
      text: "should have a package comment"
207
      linters:
208
        - revive
209
    - path: internal/app/machined/pkg/system/events
210
      text: "should have a package comment"
211
      linters:
212
        - revive
213
    - path: internal/app/machined/pkg/system/health
214
      text: "should have a package comment"
215
      linters:
216
        - revive
217
    - path: internal/app/machined/pkg/system/runner/containerd
218
      text: "should have a package comment"
219
      linters:
220
        - revive
221
    - path: internal/app/machined/pkg/system/runner/goroutine
222
      text: "should have a package comment"
223
      linters:
224
        - revive
225
    - path: internal/app/machined/pkg/system/runner/process
226
      text: "should have a package comment"
227
      linters:
228
        - revive
229
    - path: internal/app/machined/pkg/system/runner/restart
230
      text: "should have a package comment"
231
      linters:
232
        - revive
233
    - path: internal/app/machined/pkg/system
234
      text: "should have a package comment"
235
      linters:
236
        - revive
237
    - path: internal/app/maintenance
238
      text: "should have a package comment"
239
      linters:
240
        - revive
241
    - path: internal/app/maintenance/server
242
      text: "should have a package comment"
243
      linters:
244
        - revive
245
    - path: internal/app/poweroff
246
      text: "should have a package comment"
247
      linters:
248
        - revive
249
    - path: internal/app/trustd/internal/reg
250
      text: "should have a package comment"
251
      linters:
252
        - revive
253
    - path: internal/app/trustd
254
      text: "should have a package comment"
255
      linters:
256
        - revive
257
    - path: internal/pkg/containers/image
258
      text: "should have a package comment"
259
      linters:
260
        - revive
261
    - path: internal/pkg/etcd
262
      text: "should have a package comment"
263
      linters:
264
        - revive
265
    - path: internal/pkg/install
266
      text: "should have a package comment"
267
      linters:
268
        - revive
269
    - path: internal/pkg/mount
270
      text: "should have a package comment"
271
      linters:
272
        - revive
273
    - path: internal/pkg/mount/switchroot
274
      text: "should have a package comment"
275
      linters:
276
        - revive
277
    - path: internal/pkg/tui/components
278
      text: "should have a package comment"
279
      linters:
280
        - revive
281
    - path: pkg/argsbuilder
282
      text: "should have a package comment"
283
      linters:
284
        - revive
285
    - path: pkg/chunker
286
      text: "should have a package comment"
287
      linters:
288
        - revive
289
    - path: pkg/chunker/file
290
      text: "should have a package comment"
291
      linters:
292
        - revive
293
    - path: pkg/chunker/stream
294
      text: "should have a package comment"
295
      linters:
296
        - revive
297
    - path: pkg/download
298
      text: "should have a package comment"
299
      linters:
300
        - revive
301
    - path: pkg/grpc/dialer
302
      text: "should have a package comment"
303
      linters:
304
        - revive
305
    - path: pkg/grpc/factory
306
      text: "should have a package comment"
307
      linters:
308
        - revive
309
    - path: pkg/grpc/gen
310
      text: "should have a package comment"
311
      linters:
312
        - revive
313
    - path: pkg/grpc/middleware/auth/basic
314
      text: "should have a package comment"
315
      linters:
316
        - revive
317
    - path: pkg/grpc/middleware/authz
318
      text: "should have a package comment"
319
      linters:
320
        - revive
321
    - path: pkg/kubernetes
322
      text: "should have a package comment"
323
      linters:
324
        - revive
325
    - path: pkg/kubernetes/inject
326
      text: "should have a package comment"
327
      linters:
328
        - revive
329
    - path: pkg/provision/providers
330
      text: "should have a package comment"
331
      linters:
332
        - revive
333
    - path: pkg/provision/providers/qemu
334
      text: "should have a package comment"
335
      linters:
336
        - revive
337
    - path: config/encoder
338
      text: "should have a package comment"
339
      linters:
340
        - revive
341
    - path: resources/kubespan
342
      text: "should have a package comment"
343
      linters:
344
        - revive
345
    - path: client/config
346
      text: "should have a package comment"
347
      linters:
348
        - revive
349
    - path: config/merge
350
      text: "should have a package comment"
351
      linters:
352
        - revive
353
    - path: config/types/v1alpha1/bundle
354
      text: "should have a package comment"
355
      linters:
356
        - revive
357
    - path: resources/cri
358
      text: "should have a package comment"
359
      linters:
360
        - revive
361
    - path: resources/runtime
362
      text: "should have a package comment"
363
      linters:
364
        - revive
365
    - path: kernel
366
      text: "should have a package comment"
367
      linters:
368
        - revive
369
    - path: constants
370
      text: "should have a package comment"
371
      linters:
372
        - revive
373
    - path: resources/perf
374
      text: "should have a package comment"
375
      linters:
376
        - revive
377
    - path: resources/cluster
378
      text: "should have a package comment"
379
      linters:
380
        - revive
381
    - path: role
382
      text: "should have a package comment"
383
      linters:
384
        - revive
385
    - path: resources/hardware
386
      text: "should have a package comment"
387
      linters:
388
        - revive
389
    - path: config/decoder
390
      text: "should have a package comment"
391
      linters:
392
        - revive
393
    - path: config/internal/cis
394
      text: "should have a package comment"
395
      linters:
396
        - revive
397
    - path: config/types/v1alpha1/machine
398
      text: "should have a package comment"
399
      linters:
400
        - revive
401

402
    # pkg/machinery module
403
    - path: config/types/v1alpha1
404
      linters:
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
409
      linters:
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.
416
  exclude-use-default: false
417

418
  # Maximum issues count per one linter. Set to 0 to disable. Default is 50.
419
  max-issues-per-linter: 0
420

421
  # Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
422
  max-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.
430
  new: false
431

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.