blob: 5f69cc027c2479f9a196bac03417dca9aa6b679f [file] [log] [blame]
Abhay Kumara2ae5992025-11-10 14:02:24 +00001version: "2"
Joey Armstrong5f51f2e2023-01-17 17:06:26 -05002run:
Abhay Kumara2ae5992025-11-10 14:02:24 +00003 issues-exit-code: 1
4 tests: true
Joey Armstrong5f51f2e2023-01-17 17:06:26 -05005linters:
Abhay Kumara2ae5992025-11-10 14:02:24 +00006 default: none
Joey Armstrong5f51f2e2023-01-17 17:06:26 -05007 enable:
Abhay Kumara2ae5992025-11-10 14:02:24 +00008 - asasalint
9 - bodyclose
10 - depguard
11 - errcheck
12 - errorlint
13 - godot
14 - gosec
15 - govet
16 - ineffassign
Joey Armstrong5f51f2e2023-01-17 17:06:26 -050017 - misspell
Abhay Kumara2ae5992025-11-10 14:02:24 +000018 - perfsprint
19 - revive
20 - staticcheck
21 - testifylint
22 - unconvert
23 - unparam
24 - unused
25 - usestdlibvars
26 - usetesting
27 settings:
28 depguard:
29 rules:
30 auto/sdk:
31 files:
32 - '!internal/global/trace.go'
33 - ~internal/global/trace_test.go
34 deny:
35 - pkg: go.opentelemetry.io/auto/sdk
36 desc: Do not use SDK from automatic instrumentation.
37 non-tests:
38 files:
39 - '!$test'
40 - '!**/*test/*.go'
41 - '!**/internal/matchers/*.go'
42 deny:
43 - pkg: testing
44 - pkg: github.com/stretchr/testify
45 - pkg: crypto/md5
46 - pkg: crypto/sha1
47 - pkg: crypto/**/pkix
48 otel-internal:
49 files:
50 - '**/sdk/*.go'
51 - '**/sdk/**/*.go'
52 - '**/exporters/*.go'
53 - '**/exporters/**/*.go'
54 - '**/schema/*.go'
55 - '**/schema/**/*.go'
56 - '**/metric/*.go'
57 - '**/metric/**/*.go'
58 - '**/bridge/*.go'
59 - '**/bridge/**/*.go'
60 - '**/trace/*.go'
61 - '**/trace/**/*.go'
62 - '**/log/*.go'
63 - '**/log/**/*.go'
64 deny:
65 - pkg: go.opentelemetry.io/otel/internal$
66 desc: Do not use cross-module internal packages.
67 - pkg: go.opentelemetry.io/otel/internal/internaltest
68 desc: Do not use cross-module internal packages.
69 otlp-internal:
70 files:
71 - '!**/exporters/otlp/internal/**/*.go'
72 deny:
73 - pkg: go.opentelemetry.io/otel/exporters/otlp/internal
74 desc: Do not use cross-module internal packages.
75 otlpmetric-internal:
76 files:
77 - '!**/exporters/otlp/otlpmetric/internal/*.go'
78 - '!**/exporters/otlp/otlpmetric/internal/**/*.go'
79 deny:
80 - pkg: go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal
81 desc: Do not use cross-module internal packages.
82 otlptrace-internal:
83 files:
84 - '!**/exporters/otlp/otlptrace/*.go'
85 - '!**/exporters/otlp/otlptrace/internal/**.go'
86 deny:
87 - pkg: go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal
88 desc: Do not use cross-module internal packages.
89 godot:
90 exclude:
91 # Exclude links.
92 - '^ *\[[^]]+\]:'
93 # Exclude sentence fragments for lists.
94 - ^[ ]*[-•]
95 # Exclude sentences prefixing a list.
96 - :$
97 misspell:
98 locale: US
99 ignore-rules:
100 - cancelled
101 perfsprint:
102 int-conversion: true
103 err-error: true
104 errorf: true
105 sprintf1: true
106 strconcat: true
107 revive:
108 confidence: 0.01
109 rules:
110 - name: blank-imports
111 - name: bool-literal-in-expr
112 - name: constant-logical-expr
113 - name: context-as-argument
114 arguments:
115 - allowTypesBefore: '*testing.T'
116 disabled: true
117 - name: context-keys-type
118 - name: deep-exit
119 - name: defer
120 arguments:
121 - - call-chain
122 - loop
123 - name: dot-imports
124 - name: duplicated-imports
125 - name: early-return
126 arguments:
127 - preserveScope
128 - name: empty-block
129 - name: empty-lines
130 - name: error-naming
131 - name: error-return
132 - name: error-strings
133 - name: errorf
134 - name: exported
135 arguments:
136 - sayRepetitiveInsteadOfStutters
137 - name: flag-parameter
138 - name: identical-branches
139 - name: if-return
140 - name: import-shadowing
141 - name: increment-decrement
142 - name: indent-error-flow
143 arguments:
144 - preserveScope
145 - name: package-comments
146 - name: range
147 - name: range-val-in-closure
148 - name: range-val-address
149 - name: redefines-builtin-id
150 - name: string-format
151 arguments:
152 - - panic
153 - /^[^\n]*$/
154 - must not contain line breaks
155 - name: struct-tag
156 - name: superfluous-else
157 arguments:
158 - preserveScope
159 - name: time-equal
160 - name: unconditional-recursion
161 - name: unexported-return
162 - name: unhandled-error
163 arguments:
164 - fmt.Fprint
165 - fmt.Fprintf
166 - fmt.Fprintln
167 - fmt.Print
168 - fmt.Printf
169 - fmt.Println
170 - name: unnecessary-stmt
171 - name: useless-break
172 - name: var-declaration
173 - name: var-naming
174 arguments:
175 - ["ID"] # AllowList
176 - ["Otel", "Aws", "Gcp"] # DenyList
177 - name: waitgroup-by-value
178 testifylint:
179 enable-all: true
180 disable:
181 - float-compare
182 - go-require
183 - require-error
184 exclusions:
185 generated: lax
186 presets:
187 - common-false-positives
188 - legacy
189 - std-error-handling
190 rules:
191 - linters:
192 - revive
193 path: schema/v.*/types/.*
194 text: avoid meaningless package names
195 # TODO: Having appropriate comments for exported objects helps development,
196 # even for objects in internal packages. Appropriate comments for all
197 # exported objects should be added and this exclusion removed.
198 - linters:
199 - revive
200 path: .*internal/.*
201 text: exported (method|function|type|const) (.+) should have comment or be unexported
202 # Yes, they are, but it's okay in a test.
203 - linters:
204 - revive
205 path: _test\.go
206 text: exported func.*returns unexported type.*which can be annoying to use
207 # Example test functions should be treated like main.
208 - linters:
209 - revive
210 path: example.*_test\.go
211 text: calls to (.+) only in main[(][)] or init[(][)] functions
212 # It's okay to not run gosec and perfsprint in a test.
213 - linters:
214 - gosec
215 - perfsprint
216 path: _test\.go
217 # Ignoring gosec G404: Use of weak random number generator (math/rand instead of crypto/rand)
218 # as we commonly use it in tests and examples.
219 - linters:
220 - gosec
221 text: 'G404:'
222 # Ignoring gosec G402: TLS MinVersion too low
223 # as the https://pkg.go.dev/crypto/tls#Config handles MinVersion default well.
224 - linters:
225 - gosec
226 text: 'G402: TLS MinVersion too low.'
227 paths:
228 - third_party$
229 - builtin$
230 - examples$
Joey Armstrong5f51f2e2023-01-17 17:06:26 -0500231issues:
Abhay Kumara2ae5992025-11-10 14:02:24 +0000232 max-issues-per-linter: 0
233 max-same-issues: 0
234formatters:
235 enable:
236 - gofumpt
237 - goimports
238 - golines
239 settings:
240 goimports:
241 local-prefixes:
242 - go.opentelemetry.io
243 golines:
244 max-len: 120
245 exclusions:
246 generated: lax
247 paths:
248 - third_party$
249 - builtin$
250 - examples$