1+ version : " 2"
12# options for analysis running
23run :
4+ # Allow multiple parallel golangci-lint instances running.
5+ # If false (default) - golangci-lint acquires file lock on start.
6+ allow-parallel-runners : true
7+
38 # default concurrency is a available CPU number
49 concurrency : 4
510
1217 # include test files or not, default is true
1318 tests : true
1419
15- # which dirs to skip: issues from them won't be reported;
16- # can use regexp here: generated.*, regexp is applied on full path;
17- # default value is empty list, but default dirs are skipped independently
18- # from this option's value (see skip-dirs-use-default).
19- skip-dirs :
20-
21- # which files to skip: they will be analyzed, but issues from them
22- # won't be reported. Default value is empty list, but there is
23- # no need to include all autogenerated files, we confidently recognize
24- # autogenerated files. If it's not please let us know.
25- skip-files :
26-
2720 # by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules":
2821 # If invoked with -mod=readonly, the go command is disallowed from the implicit
2922 # automatic updating of go.mod described above. Instead, it fails when any changes
@@ -36,80 +29,250 @@ run:
3629
3730# output configuration options
3831output :
39- # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
40- formats : colored-line-number
41-
42- # print lines of code with issue, default is true
43- print-issued-lines : true
44-
45- # print linter name in the end of issue text, default is true
46- print-linter-name : true
47-
48- # all available settings of specific linters
49- linters-settings :
50- govet :
51- # settings per analyzer
52- settings :
53- printf : # analyzer name, run `go tool vet help` to see all analyzers
54- funcs : # run `go tool vet help printf` to see available settings for `printf` analyzer
55- - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
56- - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
57- - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
58- - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
59-
60- enable-all : true
61- disable :
62- - fieldalignment
63-
64- revive :
65- # minimal confidence for issues, default is 0.8
66- min-confidence : 0.8
67-
68- gofmt :
69- # simplify code: gofmt with `-s` option, true by default
70- simplify : true
71-
72- staticcheck :
73- checks : [all, -nilness]
74-
75- goimports :
76- # put imports beginning with prefix after 3rd-party packages;
77- # it's a comma-separated list of prefixes
78- local-prefixes : github.com/signalfx/splunk-otel-collector,github.com/signalfx/signalfx-agent
79-
80- misspell :
81- # Correct spellings using locale preferences for US or UK.
82- # Default is to use a neutral variety of English.
83- # Setting locale to US will correct the British spelling of 'colour' to 'color'.
84- locale : US
85- ignore-words :
86- - cancelled
87- - metre
88- - meter
89- - metres
90- - kilometre
91- - kilometres
32+ # The formats used to render issues.
33+ formats :
34+ colored-line-number :
35+ path : stdout
36+
37+ # Show statistics per linter.
38+ show-stats : false
39+
40+ formatters :
41+ enable :
42+ # - gofumpt
43+ - goimports
44+
45+ settings :
46+ gofmt :
47+ # simplify code: gofmt with `-s` option, true by default
48+ simplify : true
49+
50+ # gofumpt:
51+ # Choose whether to use the extra rules
52+ # extra-rules: true
53+
54+ goimports :
55+ # put imports beginning with prefix after 3rd-party packages;
56+ # it's a comma-separated list of prefixes
57+ local-prefixes :
58+ - github.com/signalfx/splunk-otel-collector
59+ - github.com/signalfx/signalfx-agent
9260
9361linters :
9462 disable :
9563 - errcheck
9664 enable :
65+ - asasalint
9766 - copyloopvar
67+ - decorder
68+ - errcheck
9869 - gocritic
99- - gofmt
100- - goimports
10170 - gosec
10271 - govet
10372 - misspell
10473 - revive
10574 - staticcheck
10675 - unconvert
10776 - unparam
77+ - unused
78+ # Enable additional linters as needed in the future
79+ # - contextcheck
80+ # - depguard
81+ # - errorlint
82+ # - fatcontext
83+ # - nolintlint
84+ # - perfsprint
85+ # - testifylint
86+ # - thelper
87+ # - usestdlibvars
88+ # - usetesting
89+ # - whitespace
90+
91+ exclusions :
92+ presets :
93+ - std-error-handling
94+
95+ # Excluding configuration per-path, per-linter, per-text and per-source
96+ rules : []
97+
98+ # all available settings of specific linters
99+ settings :
100+ depguard :
101+ rules :
102+ denied-deps :
103+ deny :
104+ - pkg : " go.uber.org/atomic"
105+ desc : " Use 'sync/atomic' instead of go.uber.org/atomic"
106+ - pkg : " github.com/pkg/errors"
107+ desc : " Use 'errors' or 'fmt' instead of github.com/pkg/errors"
108+ - pkg : " github.com/hashicorp/go-multierror"
109+ desc : " Use go.uber.org/multierr instead of github.com/hashicorp/go-multierror"
110+ - pkg : " math/rand$"
111+ desc : " Use the newer 'math/rand/v2' instead of math/rand"
112+ - pkg : " sigs.k8s.io/yaml"
113+ desc : " Use 'go.yaml.in/yaml' instead of sigs.k8s.io/yaml"
114+ # Add a different guard rule so that we can ignore tests.
115+ ignore-in-test :
116+ # Allow in tests for testing pdata or other receivers/exporters that expect OTLP.
117+ files :
118+ - ' !**/*_test.go'
119+ deny :
120+ - pkg : go.opentelemetry.io/proto
121+ desc : Use go.opentelemetry.io/collector/pdata instead
122+
123+ gocritic :
124+ disabled-checks :
125+ - deferInLoop
126+ - filepathJoin
127+ - hugeParam
128+ - importShadow
129+ - rangeValCopy
130+ - unnamedResult
131+ - whyNoLint
132+ - paramTypeCombine
133+ - yodaStyleExpr
134+ - sloppyReassign
135+ - emptyStringTest
136+ - octalLiteral
137+ - exposedSyncMutex
138+ - preferStringWriter
139+ - nestingReduce
140+ - typeUnparen
141+ - ptrToRefParam
142+ - regexpSimplify
143+ - stringConcatSimplify
144+ - httpNoBody
145+ - stringXbytes
146+ - redundantSprint
147+ enable-all : true
148+
149+ gosec :
150+ excludes :
151+ - G104 # Errors unhandled.
152+ - G301 # TLS InsecureSkipVerify set true.
153+ - G302 # Poor file permissions used when creating a new file or directory.
154+ - G304 # File path provided as tainted input to file opening function.
155+
156+ govet :
157+ enable-all : true
158+ # settings per analyzer
159+ settings :
160+ printf : # analyzer name, run `go tool vet help` to see all analyzers
161+ funcs : # run `go tool vet help printf` to see available settings for `printf` analyzer
162+ - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
163+ - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
164+ - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
165+ - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
166+
167+ misspell :
168+ # Correct spellings using locale preferences for US or UK.
169+ # Default is to use a neutral variety of English.
170+ # Setting locale to US will correct the British spelling of 'colour' to 'color'.
171+ locale : US
172+
173+ nolintlint :
174+ require-specific : true
175+
176+ perfsprint :
177+ # Optimizes even if it requires an int or uint type cast.
178+ int-conversion : true
179+ # Optimizes into `err.Error()` even if it is only equivalent for non-nil errors.
180+ err-error : true
181+ # Optimizes `fmt.Errorf`.
182+ errorf : true
183+ # Optimizes `fmt.Sprintf` with only one argument.
184+ sprintf1 : true
185+ # Optimizes into strings concatenation.
186+ strconcat : true
187+
188+ revive :
189+ # minimal confidence for issues, default is 0.8
190+ confidence : 0.8
191+ rules :
192+ # Blank import should be only in a main or test package, or have a comment justifying it.
193+ - name : blank-imports
194+ # context.Context() should be the first parameter of a function when provided as argument.
195+ - name : context-as-argument
196+ # Basic types should not be used as a key in `context.WithValue`
197+ - name : context-keys-type
198+ # Importing with `.` makes the programs much harder to understand
199+ - name : dot-imports
200+ # Enable this rule after refactoring in the if else block.
201+ # - name: early-return
202+ # arguments:
203+ # - preserveScope
204+ # Empty blocks make code less readable and could be a symptom of a bug or unfinished refactoring.
205+ - name : empty-block
206+ # for better readability, variables of type `error` must be named with the prefix `err`.
207+ - name : error-naming
208+ # for better readability, the errors should be last in the list of returned values by a function.
209+ - name : error-return
210+ # for better readability, error messages should not be capitalized or end with punctuation or a newline.
211+ - name : error-strings
212+ # report when replacing `errors.New(fmt.Sprintf())` with `fmt.Errorf()` is possible
213+ - name : errorf
214+ # incrementing an integer variable by 1 is recommended to be done using the `++` operator
215+ - name : increment-decrement
216+ # highlights redundant else-blocks that can be eliminated from the code
217+ - name : indent-error-flow
218+ # This rule suggests a shorter way of writing ranges that do not use the second value.
219+ - name : range
220+ # receiver names in a method should reflect the struct name (p for Person, for example)
221+ - name : receiver-naming
222+ # redefining built in names (true, false, append, make) can lead to bugs very difficult to detect.
223+ - name : redefines-builtin-id
224+ # redundant else-blocks that can be eliminated from the code.
225+ - name : superfluous-else
226+ arguments :
227+ - preserveScope
228+ # prevent confusing name for variables when using `time` package
229+ - name : time-naming
230+ # warns when an exported function or method returns a value of an un-exported type.
231+ - name : unexported-return
232+ - name : unnecessary-stmt
233+ # spots and proposes to remove unreachable code. also helps to spot errors
234+ - name : unreachable-code
235+ # Functions or methods with unused parameters can be a symptom of an unfinished refactoring or a bug.
236+ - name : unused-parameter
237+ # Since Go 1.18, interface{} has an alias: any. This rule proposes to replace instances of interface{} with any.
238+ # Enable this rule after refactoring in the affected places.
239+ # - name: use-any
240+ # report when a variable declaration can be simplified
241+ - name : var-declaration
242+ # warns when initialism, variable or package naming conventions are not followed.
243+ - name : var-naming
244+
245+ staticcheck :
246+ checks :
247+ - all
248+ - -SA4011 # disable: analysis of atomic values is unsound
249+ - -ST1000
250+ - -ST1003
251+ - -ST1020
252+ - -ST1021
253+ - -QF1007
254+ - -QF1008
255+
256+ testifylint :
257+ enable-all : true
258+
259+ thelper :
260+ benchmark :
261+ begin : false
262+ fuzz :
263+ begin : false
264+ tb :
265+ begin : false
266+ test :
267+ begin : false
108268
109269issues :
270+ # Maximum issues count per one linter.
271+ max-issues-per-linter : 0
272+ # Maximum count of issues with the same text.
273+ max-same-issues : 0
110274 exclude-rules :
111275 - text : " SA1019: \" github.com/signalfx/splunk-otel-collector/internal/exporter/httpsinkexporter"
112276 linters :
113277 - staticcheck
114-
115- exclude-dirs-use-default : false
278+ exclude-dirs-use-default : false
0 commit comments