...
1linters:
2 enable:
3 - bodyclose
4 - depguard
5 - dogsled
6 - dupword # Detects duplicate words.
7 - durationcheck
8 - errchkjson
9 - exportloopref # Detects pointers to enclosing loop variables.
10 - gocritic # Metalinter; detects bugs, performance, and styling issues.
11 - gocyclo
12 - gofumpt # Detects whether code was gofumpt-ed.
13 - goimports
14 - gosec # Detects security problems.
15 - gosimple
16 - govet
17 - ineffassign
18 - lll
19 - megacheck
20 - misspell # Detects commonly misspelled English words in comments.
21 - nakedret
22 - nilerr # Detects code that returns nil even if it checks that the error is not nil.
23 - nolintlint # Detects ill-formed or insufficient nolint directives.
24 - perfsprint # Detects fmt.Sprintf uses that can be replaced with a faster alternative.
25 - prealloc # Detects slice declarations that could potentially be pre-allocated.
26 - predeclared # Detects code that shadows one of Go's predeclared identifiers
27 - reassign
28 - revive # Metalinter; drop-in replacement for golint.
29 - staticcheck
30 - stylecheck # Replacement for golint
31 - tenv # Detects using os.Setenv instead of t.Setenv.
32 - thelper # Detects test helpers without t.Helper().
33 - tparallel # Detects inappropriate usage of t.Parallel().
34 - typecheck
35 - unconvert # Detects unnecessary type conversions.
36 - unparam
37 - unused
38 - usestdlibvars
39 - vet
40 - wastedassign
41
42 disable:
43 - errcheck
44
45run:
46 timeout: 5m
47 skip-files:
48 - cli/compose/schema/bindata.go
49 - .*generated.*
50
51linters-settings:
52 depguard:
53 rules:
54 main:
55 deny:
56 - pkg: io/ioutil
57 desc: The io/ioutil package has been deprecated, see https://go.dev/doc/go1.16#ioutil
58 gocyclo:
59 min-complexity: 16
60 govet:
61 check-shadowing: true
62 settings:
63 shadow:
64 strict: true
65 lll:
66 line-length: 200
67 nakedret:
68 command: nakedret
69 pattern: ^(?P<path>.*?\\.go):(?P<line>\\d+)\\s*(?P<message>.*)$
70
71 revive:
72 rules:
73 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#import-shadowing
74 - name: import-shadowing
75 severity: warning
76 disabled: false
77 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-block
78 - name: empty-block
79 severity: warning
80 disabled: false
81 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-lines
82 - name: empty-lines
83 severity: warning
84 disabled: false
85 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#use-any
86 - name: use-any
87 severity: warning
88 disabled: false
89
90issues:
91 # The default exclusion rules are a bit too permissive, so copying the relevant ones below
92 exclude-use-default: false
93
94 exclude:
95 - parameter .* always receives
96
97 exclude-rules:
98 # We prefer to use an "exclude-list" so that new "default" exclusions are not
99 # automatically inherited. We can decide whether or not to follow upstream
100 # defaults when updating golang-ci-lint versions.
101 # Unfortunately, this means we have to copy the whole exclusion pattern, as
102 # (unlike the "include" option), the "exclude" option does not take exclusion
103 # ID's.
104 #
105 # These exclusion patterns are copied from the default excluses at:
106 # https://github.com/golangci/golangci-lint/blob/v1.44.0/pkg/config/issues.go#L10-L104
107
108 # EXC0001
109 - text: "Error return value of .((os\\.)?std(out|err)\\..*|.*Close|.*Flush|os\\.Remove(All)?|.*print(f|ln)?|os\\.(Un)?Setenv). is not checked"
110 linters:
111 - errcheck
112 # EXC0003
113 - text: "func name will be used as test\\.Test.* by other packages, and that stutters; consider calling this"
114 linters:
115 - revive
116 # EXC0006
117 - text: "Use of unsafe calls should be audited"
118 linters:
119 - gosec
120 # EXC0007
121 - text: "Subprocess launch(ed with variable|ing should be audited)"
122 linters:
123 - gosec
124 # EXC0008
125 # TODO: evaluate these and fix where needed: G307: Deferring unsafe method "*os.File" on type "Close" (gosec)
126 - text: "G307"
127 linters:
128 - gosec
129 # EXC0009
130 - text: "(Expect directory permissions to be 0750 or less|Expect file permissions to be 0600 or less)"
131 linters:
132 - gosec
133 # EXC0010
134 - text: "Potential file inclusion via variable"
135 linters:
136 - gosec
137
138 # G113 Potential uncontrolled memory consumption in Rat.SetString (CVE-2022-23772)
139 # only affects gp < 1.16.14. and go < 1.17.7
140 - text: "G113"
141 linters:
142 - gosec
143 # TODO: G104: Errors unhandled. (gosec)
144 - text: "G104"
145 linters:
146 - gosec
147 # Looks like the match in "EXC0007" above doesn't catch this one
148 # TODO: consider upstreaming this to golangci-lint's default exclusion rules
149 - text: "G204: Subprocess launched with a potential tainted input or cmd arguments"
150 linters:
151 - gosec
152 # Looks like the match in "EXC0009" above doesn't catch this one
153 # TODO: consider upstreaming this to golangci-lint's default exclusion rules
154 - text: "G306: Expect WriteFile permissions to be 0600 or less"
155 linters:
156 - gosec
157
158 # TODO: make sure all packages have a description. Currently, there's 67 packages without.
159 - text: "package-comments: should have a package comment"
160 linters:
161 - revive
162 # FIXME temporarily suppress these (see https://github.com/gotestyourself/gotest.tools/issues/272)
163 - text: "SA1019: (assert|cmp|is)\\.ErrorType is deprecated"
164 linters:
165 - staticcheck
166 # Exclude some linters from running on tests files.
167 - path: _test\.go
168 linters:
169 - errcheck
170 - gosec
171 - text: "ST1000: at least one file in a package should have a package comment"
172 linters:
173 - stylecheck
174
175 # Allow "err" and "ok" vars to shadow existing declarations, otherwise we get too many false positives.
176 - text: '^shadow: declaration of "(err|ok)" shadows declaration'
177 linters:
178 - govet
179
180
181 # Maximum issues count per one linter. Set to 0 to disable. Default is 50.
182 max-issues-per-linter: 0
183
184 # Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
185 max-same-issues: 0
View as plain text