Debian Codegraph @

.golangci.yml

raw symbols SCIP
1 formatters:
2 enable:
3 - gofumpt
4 - goimports
5
6 settings:
7 gofmt:
8 # simplify code: gofmt with `-s` option, true by default
9 simplify: true
10
11 gofumpt:
12 # Choose whether to use the extra rules
13 extra-rules: true
14
15 goimports:
16 # put imports beginning with prefix after 3rd-party packages;
17 # it's a comma-separated list of prefixes
18 local-prefixes:
19 - go.opentelemetry.io/collector
20
21 issues:
22 # Maximum issues count per one linter.
23 max-issues-per-linter: 0
24 # Maximum count of issues with the same text.
25 max-same-issues: 0
26
27 linters:
28 enable:
29 - asasalint
30 - contextcheck
31 - copyloopvar
32 - decorder
33 - depguard
34 - errcheck
35 - errorlint
36 - fatcontext
37 - gocritic
38 - gosec
39 - govet
40 - misspell
41 - modernize
42 - nolintlint
43 - perfsprint
44 - revive
45 - staticcheck
46 - testifylint
47 - thelper
48 - unconvert
49 - unparam
50 - unused
51 - usestdlibvars
52 - usetesting
53 - whitespace
54
55 exclusions:
56 presets:
57 - std-error-handling
58
59 # Excluding configuration per-path, per-linter, per-text and per-source
60 rules: []
61
62 # Log a warning if an exclusion rule is unused.
63 warn-unused: true
64
65 # all available settings of specific linters
66 settings:
67 depguard:
68 rules:
69 denied-deps:
70 deny:
71 - pkg: "go.uber.org/atomic"
72 desc: "Use 'sync/atomic' instead of go.uber.org/atomic"
73 - pkg: "github.com/pkg/errors"
74 desc: "Use 'errors' or 'fmt' instead of github.com/pkg/errors"
75 - pkg: "github.com/hashicorp/go-multierror"
76 desc: "Use go.uber.org/multierr instead of github.com/hashicorp/go-multierror"
77 - pkg: "math/rand$"
78 desc: "Use the newer 'math/rand/v2' instead of math/rand"
79 - pkg: "sigs.k8s.io/yaml"
80 desc: "Use 'go.yaml.in/yaml' instead of sigs.k8s.io/yaml"
81 semconv:
82 list-mode: lax
83 files:
84 - "!cmd/mdatagen/**" # Exclude mdatagen
85 deny:
86 - pkg: go.opentelemetry.io/otel/semconv
87 desc: Use go.opentelemetry.io/otel/semconv/v1.37.0 instead. If a newer semconv version has been released, update the depguard rule.
88 allow:
89 - go.opentelemetry.io/otel/semconv/v1.37.0
90 # Add a different guard rule so that we can ignore tests.
91 ignore-in-test:
92 # Allow in tests for testing pdata or other receivers/exporters that expect OTLP.
93 files:
94 - '!**/*_test.go'
95 deny:
96 - pkg: go.opentelemetry.io/proto
97 desc: Use go.opentelemetry.io/collector/pdata instead
98
99 gocritic:
100 disabled-checks:
101 - commentedOutCode
102 - deferInLoop
103 - filepathJoin
104 - hugeParam
105 - importShadow
106 - rangeValCopy
107 - unnamedResult
108 - whyNoLint
109 enable-all: true
110
111 gosec:
112 excludes:
113 - G104 # FIXME
114 - G402
115 - G404
116
117 govet:
118 disable:
119 # We want to order fields according to readability and grouping them by use cases.
120 # This linter does not offer a discernible performance improvement as the structs
121 # defined in this repository are not in the execution hot path.
122 # See https://github.com/open-telemetry/opentelemetry-collector/issues/2789
123 - fieldalignment
124 enable-all: true
125 # settings per analyzer
126 settings:
127 printf: # analyzer name, run `go tool vet help` to see all analyzers
128 funcs: # run `go tool vet help printf` to see available settings for `printf` analyzer
129 - Infof
130 - Warnf
131 - Errorf
132 - Fatalf
133
134 misspell:
135 # Correct spellings using locale preferences for US or UK.
136 # Default is to use a neutral variety of English.
137 # Setting locale to US will correct the British spelling of 'colour' to 'color'.
138 locale: US
139 ignore-rules:
140 - cancelled
141
142 nolintlint:
143 require-specific: true
144
145 perfsprint:
146 # Optimizes even if it requires an int or uint type cast.
147 int-conversion: true
148 # Optimizes into `err.Error()` even if it is only equivalent for non-nil errors.
149 err-error: true
150 # Optimizes `fmt.Errorf`.
151 errorf: true
152 # Optimizes `fmt.Sprintf` with only one argument.
153 sprintf1: true
154 # Optimizes into strings concatenation.
155 strconcat: true
156
157 revive:
158 # minimal confidence for issues, default is 0.8
159 confidence: 0.8
160 rules:
161 # Blank import should be only in a main or test package, or have a comment justifying it.
162 - name: blank-imports
163 # context.Context() should be the first parameter of a function when provided as argument.
164 - name: context-as-argument
165 # Basic types should not be used as a key in `context.WithValue`
166 - name: context-keys-type
167 # Importing with `.` makes the programs much harder to understand
168 - name: dot-imports
169 - name: early-return
170 arguments:
171 - preserveScope
172 # Empty blocks make code less readable and could be a symptom of a bug or unfinished refactoring.
173 - name: empty-block
174 # for better readability, variables of type `error` must be named with the prefix `err`.
175 - name: error-naming
176 # for better readability, the errors should be last in the list of returned values by a function.
177 - name: error-return
178 # for better readability, error messages should not be capitalized or end with punctuation or a newline.
179 - name: error-strings
180 # report when replacing `errors.New(fmt.Sprintf())` with `fmt.Errorf()` is possible
181 - name: errorf
182 # incrementing an integer variable by 1 is recommended to be done using the `++` operator
183 - name: increment-decrement
184 # highlights redundant else-blocks that can be eliminated from the code
185 - name: indent-error-flow
186 # This rule suggests a shorter way of writing ranges that do not use the second value.
187 - name: range
188 # receiver names in a method should reflect the struct name (p for Person, for example)
189 - name: receiver-naming
190 # redefining built in names (true, false, append, make) can lead to bugs very difficult to detect.
191 - name: redefines-builtin-id
192 # redundant else-blocks that can be eliminated from the code.
193 - name: superfluous-else
194 arguments:
195 - preserveScope
196 # prevent confusing name for variables when using `time` package
197 - name: time-naming
198 # warns when an exported function or method returns a value of an un-exported type.
199 - name: unexported-return
200 - name: unnecessary-stmt
201 # spots and proposes to remove unreachable code. also helps to spot errors
202 - name: unreachable-code
203 # Functions or methods with unused parameters can be a symptom of an unfinished refactoring or a bug.
204 - name: unused-parameter
205 # Since Go 1.18, interface{} has an alias: any. This rule proposes to replace instances of interface{} with any.
206 - name: use-any
207 # report when a variable declaration can be simplified
208 - name: var-declaration
209 # warns when initialism, variable or package naming conventions are not followed.
210 - name: var-naming
211
212 staticcheck:
213 checks:
214 - all
215 - -ST1000
216 - -ST1021
217 - -ST1022
218
219 testifylint:
220 enable-all: true
221
222 thelper:
223 benchmark:
224 begin: false
225 fuzz:
226 begin: false
227 tb:
228 begin: false
229 test:
230 begin: false
231
232 # output configuration options
233 output:
234 # The formats used to render issues.
235 formats:
236 # Prints issues in a text format with colors, line number, and linter name.
237 text:
238 # Output path can be either `stdout`, `stderr` or path to the file to write to.
239 path: stdout
240 # print linter name in the end of issue text, default is true
241 print-linter-name: true
242 # print lines of code with issue, default is true
243 print-issued-lines: true
244
245 # Show statistics per linter.
246 show-stats: false
247
248 # options for analysis running
249 run:
250 # Allow multiple parallel golangci-lint instances running.
251 # If false (default) - golangci-lint acquires file lock on start.
252 allow-parallel-runners: true
253
254 # default concurrency is a available CPU number
255 concurrency: 4
256
257 # by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules":
258 # If invoked with -mod=readonly, the go command is disallowed from the implicit
259 # automatic updating of go.mod described above. Instead, it fails when any changes
260 # to go.mod are needed. This setting is most useful to check that go.mod does
261 # not need updates, such as in a continuous integration and testing system.
262 # If invoked with -mod=vendor, the go command assumes that the vendor
263 # directory holds the correct copies of dependencies and ignores
264 # the dependency descriptions in go.mod.
265 modules-download-mode: readonly
266
267 # exit code when at least one issue was found, default is 1
268 issues-exit-code: 1
269
270 # include test files or not, default is true
271 tests: true
272
273 # timeout for analysis, e.g. 30s, 5m, default is 1m
274 timeout: 10m
275
276 version: "2"