summaryrefslogtreecommitdiff
path: root/.golangci.yml
blob: faf434e4dade2c8baeefad01bacb8bed25d03fa3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
run:
  tests: false
  modules-download-mode: readonly

  # Define the Go version limit.
  # Mainly related to generics support in go1.18.
  # Default: use Go version from the go.mod file, fallback on the env var `GOVERSION`, fallback on 1.18
  go: '1.21'

issues:
  # The linter has a default list of ignorable errors. Turning this on will enable that list.
  exclude-use-default: false

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

  # Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
  max-same-issues: 0

  exclude:
    - Subprocess launch(ed with variable|ing should be audited)
    - Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
    - G307 # Allow closing files as a defer without checking error.
    - composite literal uses unkeyed fields

linters:
  enable:
    - bodyclose
    - dupl
    - errcheck
    - exportloopref
    - goconst
    - godot
    - godox
    - goimports
    - goprintffuncname
    - gosec
    - govet
    - misspell
    - prealloc
    - revive
    - rowserrcheck
    - sqlclosecheck
    - staticcheck
    - unconvert
    - unparam
    - whitespace
    - nakedret
    - cyclop
    - gosimple
    - unused
    - exportloopref
    - gocritic
    - forbidigo
    - unparam
    - wastedassign
linters-settings:
  govet:
    disable:
      - composite

  cyclop:
    # the maximal code complexity to report. default is 10. eventually work our way to that.
    max-complexity: 15
    # the max average package complexity. If it's higher than 0.0 (float) the check is enabled (default 0.0)
    package-average: 0.0
    # should ignore tests
    skip-tests: true

  gosimple:
    # Select the Go version to target. The default is '1.13'.
    go: '1.21'
    # https://staticcheck.io/docs/options#checks
    checks: ['all']

  gocritic:
    disabled-checks:
      - ifElseChain
      - exitAfterDefer

  revive:
    rules:
      - name: package-comments
        disabled: true

  forbidigo:
    # Forbid the following identifiers (identifiers are written using regexp):
    forbid:
      # Logging via Print bypasses our logging framework.
      - ^(fmt\.Print(|f|ln)|print|println)
      - ^panic.*$

  dupl:
    # tokens count to trigger issue, 150 by default
    threshold: 200