1- run :
2- timeout : 10m
3-
4- linters-settings :
5- lll :
6- line-length : 170
7- dupl :
8- threshold : 400
9-
10- issues :
11- # don't skip warning about doc comments
12- exclude-use-default : false
13-
14- # restore some of the defaults
15- # (fill in the rest as needed)
16- exclude-rules :
17- - linters : [errcheck]
18- text : " Error return value of .((os\\ .)?std(out|err)\\ ..*|.*Close|.*Flush|os\\ .Remove(All)?|.*printf?|os\\ .(Un)?Setenv). is not checked"
19- exclude-dirs :
20- - vendor
21- - proto
22- - test
23- exclude-files :
24- - " .*\\ _test\\ .go$"
25- - " .*\\ _string\\ .go$"
26- - " pkg/response/actions/k8s/control.go"
27- - " pkg/response/actions/k8s/search.go"
1+ # This configuration file is not a recommendation.
2+ #
3+ # We intentionally use a limited set of linters.
4+ # This configuration file is used with different version of golangci-lint to avoid regressions:
5+ # the linters can change between version,
6+ # their configuration may be not compatible or their reports can be different,
7+ # and this can break some of our tests.
8+ # Also, some linters are not relevant for the project (e.g. linters related to SQL).
9+ #
10+ # We have specific constraints, so we use a specific configuration.
11+ #
12+ # See the file `.golangci.reference.yml` to have a list of all available configuration options.
13+
14+ version : " 2"
2815
2916linters :
30- disable-all : true
17+ default : none
18+ # This list of linters is not a recommendation (same thing for all this configuration file).
19+ # We intentionally use a limited set of linters.
20+ # See the comment on top of this file.
3121 enable :
32- - misspell
33- # - structcheck
34- # - golint
35- - govet
36- # - deadcode
22+ - bodyclose
23+ - copyloopvar
24+ - depguard
25+ - dogsled
26+ - dupl
3727 - errcheck
38- # - varcheck
28+ - errorlint
29+ - funlen
30+ - gocheckcompilerdirectives
31+ - gochecknoinits
3932 - goconst
40- - unparam
41- - ineffassign
42- - nakedret
33+ - gocritic
4334 - gocyclo
35+ - godox
36+ - mnd
37+ - goprintffuncname
38+ - gosec
39+ - govet
40+ - intrange
41+ - ineffassign
4442 - lll
45- - dupl
43+ - misspell
44+ - nakedret
45+ - noctx
46+ - nolintlint
47+ - revive
48+ - staticcheck
49+ - testifylint
50+ - unconvert
51+ - unparam
52+ - unused
53+ - whitespace
54+
55+ settings :
56+ depguard :
57+ rules :
58+ logger :
59+ deny :
60+ # logging is allowed only by logutils.Log,
61+ - pkg : " github.com/sirupsen/logrus"
62+ desc : logging is allowed only by logutils.Log.
63+ - pkg : " github.com/pkg/errors"
64+ desc : Should be replaced by standard lib errors package.
65+ - pkg : " github.com/instana/testify"
66+ desc : It's a fork of github.com/stretchr/testify.
67+ files :
68+ # logrus is allowed to use only in logutils package.
69+ - " !**/pkg/logutils/**.go"
70+ dupl :
71+ threshold : 100
72+ funlen :
73+ lines : -1 # the number of lines (code + empty lines) is not a right metric and leads to code without empty line or one-liner.
74+ statements : 50
75+ goconst :
76+ min-len : 2
77+ min-occurrences : 3
78+ gocritic :
79+ enabled-tags :
80+ - diagnostic
81+ - experimental
82+ - opinionated
83+ - performance
84+ - style
85+ disabled-checks :
86+ - dupImport # https://github.com/go-critic/go-critic/issues/845
87+ - ifElseChain
88+ - octalLiteral
89+ - whyNoLint
90+ gocyclo :
91+ min-complexity : 15
92+ godox :
93+ keywords :
94+ - FIXME
95+ mnd :
96+ # don't include the "operation" and "assign"
97+ checks :
98+ - argument
99+ - case
100+ - condition
101+ - return
102+ ignored-numbers :
103+ - ' 0'
104+ - ' 1'
105+ - ' 2'
106+ - ' 3'
107+ ignored-functions :
108+ - strings.SplitN
109+ - Init
110+ govet :
111+ settings :
112+ printf :
113+ funcs :
114+ - (github.com/golangci/golangci-lint/v2/pkg/logutils.Log).Infof
115+ - (github.com/golangci/golangci-lint/v2/pkg/logutils.Log).Warnf
116+ - (github.com/golangci/golangci-lint/v2/pkg/logutils.Log).Errorf
117+ - (github.com/golangci/golangci-lint/v2/pkg/logutils.Log).Fatalf
118+ enable :
119+ - nilness
120+ - shadow
121+ errorlint :
122+ asserts : false
123+ lll :
124+ line-length : 140
125+ misspell :
126+ locale : US
127+ ignore-rules :
128+ - " importas" # linter name
129+ nolintlint :
130+ allow-unused : false # report any unused nolint directives
131+ require-explanation : true # require an explanation for nolint directives
132+ require-specific : true # require nolint directives to be specific about which linter is being skipped
133+ revive :
134+ rules :
135+ - name : indent-error-flow
136+ - name : unexported-return
137+ disabled : true
138+ - name : unused-parameter
139+ - name : unused-receiver
140+
141+ exclusions :
142+ presets :
143+ - comments
144+ - std-error-handling
145+ - common-false-positives
146+ - legacy
147+ paths :
148+ - vendor
149+ - proto
150+ - test
151+ - " .*\\ _test\\ .go$"
152+ - " .*\\ _string\\ .go$"
153+ - " pkg/response/actions/k8s/control.go"
154+ - " pkg/response/actions/k8s/search.go"
155+ - " core/server"
156+ - pkg/response/actions/k8s
157+ rules :
158+ - path : (.+)_test\.go
159+ linters :
160+ - dupl
161+ - mnd
162+ - lll
163+
164+ # Based on existing code, the modifications should be limited to make maintenance easier.
165+ - path : pkg/golinters/unused/unused.go
166+ linters : [gocritic]
167+ text : " rangeValCopy: each iteration copies 160 bytes \\ (consider pointers or indexing\\ )"
168+
169+ # Related to the result of computation but divided multiple times by 1024.
170+ - path : test/bench/bench_test.go
171+ linters : [gosec]
172+ text : " G115: integer overflow conversion uint64 -> int"
173+
174+ # The files created during the tests don't need to be secured.
175+ - path : scripts/website/expand_templates/linters_test.go
176+ linters : [gosec]
177+ text : " G306: Expect WriteFile permissions to be 0600 or less"
178+
179+ # Related to migration command.
180+ - path : pkg/commands/internal/migrate/two/
181+ linters :
182+ - lll
183+
184+ # Related to migration command.
185+ - path : pkg/commands/internal/migrate/
186+ linters :
187+ - gocritic
188+ text : " hugeParam:"
189+
190+ # The codes are close but this is not duplication.
191+ - path : pkg/commands/(formatters|linters).go
192+ linters :
193+ - dupl
194+
195+ # Deprecated linters
196+ - path : pkg/lint/lintersdb/builder_linter.go
197+ text : " SA1019: wsl.NewV4 is deprecated: use NewV5 instead."
198+ linters :
199+ - staticcheck
200+ - path : pkg/golinters/wsl/wsl.go
201+ text : " SA1019: config.WSLv4Settings is deprecated: use WSLv5Settings instead."
202+ linters :
203+ - staticcheck
204+
205+ formatters :
206+ enable :
207+ - gofmt
46208 - goimports
209+ settings :
210+ gofmt :
211+ rewrite-rules :
212+ - pattern : ' interface{}'
213+ replacement : ' any'
214+ goimports :
215+ local-prefixes :
216+ - github.com/golangci/golangci-lint/v2
217+ exclusions :
218+ paths :
219+ - vendor
220+ - proto
221+ - test
222+ - " .*\\ _test\\ .go$"
223+ - " .*\\ _string\\ .go$"
224+ - " pkg/response/actions/k8s/control.go"
225+ - " pkg/response/actions/k8s/search.go"
226+ - " core/server"
0 commit comments