|
| 1 | +# options for analysis running |
| 2 | +run: |
| 3 | + # default concurrency is a available CPU number |
| 4 | + concurrency: 4 |
| 5 | + |
| 6 | + # timeout for analysis, e.g. 30s, 5m, default is 1m |
| 7 | + timeout: 20m |
| 8 | + |
| 9 | + # exit code when at least one issue was found, default is 1 |
| 10 | + issues-exit-code: 1 |
| 11 | + |
| 12 | + # include test files or not, default is true |
| 13 | + tests: true |
| 14 | + |
| 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 exclude-dirs-use-default). |
| 19 | + exclude-dirs: |
| 20 | + - third_party |
| 21 | + - local |
| 22 | + - cmd/otelcontribcol |
| 23 | + - cmd/oteltestbedcol |
| 24 | + |
| 25 | + # default is true. Enables skipping of directories: |
| 26 | + # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ |
| 27 | + exclude-dirs-use-default: false |
| 28 | + |
| 29 | + # which files to skip: they will be analyzed, but issues from them |
| 30 | + # won't be reported. Default value is empty list, but there is |
| 31 | + # no need to include all autogenerated files, we confidently recognize |
| 32 | + # autogenerated files. If it's not please let us know. |
| 33 | + skip-files: |
| 34 | + |
| 35 | + # by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules": |
| 36 | + # If invoked with -mod=readonly, the go command is disallowed from the implicit |
| 37 | + # automatic updating of go.mod described above. Instead, it fails when any changes |
| 38 | + # to go.mod are needed. This setting is most useful to check that go.mod does |
| 39 | + # not need updates, such as in a continuous integration and testing system. |
| 40 | + # If invoked with -mod=vendor, the go command assumes that the vendor |
| 41 | + # directory holds the correct copies of dependencies and ignores |
| 42 | + # the dependency descriptions in go.mod. |
| 43 | + modules-download-mode: readonly |
| 44 | + |
| 45 | +# output configuration options |
| 46 | +output: |
| 47 | + # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number" |
| 48 | + formats: colored-line-number |
| 49 | + |
| 50 | + # print lines of code with issue, default is true |
| 51 | + print-issued-lines: true |
| 52 | + |
| 53 | + # print linter name in the end of issue text, default is true |
| 54 | + print-linter-name: true |
| 55 | + |
| 56 | +# all available settings of specific linters |
| 57 | +linters-settings: |
| 58 | + gci: |
| 59 | + sections: |
| 60 | + - standard |
| 61 | + - default |
| 62 | + - prefix(github.com/scaleway/opentelemetry-collector-scaleway) |
| 63 | + |
| 64 | + govet: |
| 65 | + # settings per analyzer |
| 66 | + settings: |
| 67 | + printf: # analyzer name, run `go tool vet help` to see all analyzers |
| 68 | + funcs: # run `go tool vet help printf` to see available settings for `printf` analyzer |
| 69 | + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof |
| 70 | + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf |
| 71 | + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf |
| 72 | + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf |
| 73 | + |
| 74 | + enable-all: true |
| 75 | + # TODO: Enable this and fix the alignment issues. |
| 76 | + disable: |
| 77 | + - fieldalignment |
| 78 | + |
| 79 | + revive: |
| 80 | + # minimal confidence for issues, default is 0.8 |
| 81 | + min-confidence: 0.8 |
| 82 | + rules: |
| 83 | + # Blank import should be only in a main or test package, or have a comment justifying it. |
| 84 | + - name: blank-imports |
| 85 | + # context.Context() should be the first parameter of a function when provided as argument. |
| 86 | + - name: context-as-argument |
| 87 | + # Basic types should not be used as a key in `context.WithValue` |
| 88 | + - name: context-keys-type |
| 89 | + # Importing with `.` makes the programs much harder to understand |
| 90 | + - name: dot-imports |
| 91 | + # Empty blocks make code less readable and could be a symptom of a bug or unfinished refactoring. |
| 92 | + - name: empty-block |
| 93 | + # for better readability, variables of type `error` must be named with the prefix `err`. |
| 94 | + - name: error-naming |
| 95 | + # for better readability, the errors should be last in the list of returned values by a function. |
| 96 | + - name: error-return |
| 97 | + # for better readability, error messages should not be capitalized or end with punctuation or a newline. |
| 98 | + - name: error-strings |
| 99 | + # report when replacing `errors.New(fmt.Sprintf())` with `fmt.Errorf()` is possible |
| 100 | + - name: errorf |
| 101 | + # incrementing an integer variable by 1 is recommended to be done using the `++` operator |
| 102 | + - name: increment-decrement |
| 103 | + # highlights redundant else-blocks that can be eliminated from the code |
| 104 | + - name: indent-error-flow |
| 105 | + # This rule suggests a shorter way of writing ranges that do not use the second value. |
| 106 | + - name: range |
| 107 | + # receiver names in a method should reflect the struct name (p for Person, for example) |
| 108 | + - name: receiver-naming |
| 109 | + # redefining built in names (true, false, append, make) can lead to bugs very difficult to detect. |
| 110 | + - name: redefines-builtin-id |
| 111 | + # redundant else-blocks that can be eliminated from the code. |
| 112 | + - name: superfluous-else |
| 113 | + # prevent confusing name for variables when using `time` package |
| 114 | + - name: time-naming |
| 115 | + # warns when an exported function or method returns a value of an un-exported type. |
| 116 | + - name: unexported-return |
| 117 | + # spots and proposes to remove unreachable code. also helps to spot errors |
| 118 | + - name: unreachable-code |
| 119 | + # Functions or methods with unused parameters can be a symptom of an unfinished refactoring or a bug. |
| 120 | + - name: unused-parameter |
| 121 | + # Since Go 1.18, interface{} has an alias: any. This rule proposes to replace instances of interface{} with any. |
| 122 | + - name: use-any |
| 123 | + # report when a variable declaration can be simplified |
| 124 | + - name: var-declaration |
| 125 | + # warns when initialism, variable or package naming conventions are not followed. |
| 126 | + - name: var-naming |
| 127 | + |
| 128 | + goimports: |
| 129 | + # put imports beginning with prefix after 3rd-party packages; |
| 130 | + # it's a comma-separated list of prefixes |
| 131 | + local-prefixes: github.com/open-telemetry/opentelemetry-collector-contrib |
| 132 | + |
| 133 | + misspell: |
| 134 | + # Correct spellings using locale preferences for US or UK. |
| 135 | + # Default is to use a neutral variety of English. |
| 136 | + # Setting locale to US will correct the British spelling of 'colour' to 'color'. |
| 137 | + locale: US |
| 138 | + ignore-words: |
| 139 | + - cancelled |
| 140 | + - metre |
| 141 | + - meter |
| 142 | + - metres |
| 143 | + - kilometre |
| 144 | + - kilometres |
| 145 | + |
| 146 | + depguard: |
| 147 | + rules: |
| 148 | + denied-deps: |
| 149 | + deny: |
| 150 | + - pkg: go.uber.org/atomic |
| 151 | + desc: "Use 'sync/atomic' instead of go.uber.org/atomic" |
| 152 | + - pkg: github.com/pkg/errors |
| 153 | + desc: "Use 'errors' or 'fmt' instead of github.com/pkg/errors" |
| 154 | + - pkg: github.com/hashicorp/go-multierror |
| 155 | + desc: "Use go.uber.org/multierr instead of github.com/hashicorp/go-multierror" |
| 156 | + - pkg: "math/rand$" |
| 157 | + desc: "Use math/rand/v2 instead of math/rand" |
| 158 | + # Add a different guard rule so that we can ignore tests. |
| 159 | + ignore-in-test: |
| 160 | + deny: |
| 161 | + - pkg: go.opentelemetry.io/proto |
| 162 | + desc: "Use go.opentelemetry.io/collector/pdata instead" |
| 163 | + # Allow in tests for testing pdata or other receivers/exporters that expect OTLP. |
| 164 | + files: |
| 165 | + - "!**/*_test.go" |
| 166 | + |
| 167 | + exhaustive: |
| 168 | + explicit-exhaustive-switch: true |
| 169 | + ignore-enum-members: "pmetric.MetricTypeEmpty" |
| 170 | + |
| 171 | + nolintlint: |
| 172 | + require-specific: true |
| 173 | + |
| 174 | + predeclared: |
| 175 | + ignore: copy |
| 176 | + |
| 177 | + testifylint: |
| 178 | + disable: |
| 179 | + - float-compare |
| 180 | + - require-error |
| 181 | + - suite-subtest-run |
| 182 | + - encoded-compare # has false positives that cannot be fixed with testifylint-fix |
| 183 | + enable-all: true |
| 184 | + thelper: |
| 185 | + test: |
| 186 | + begin: false |
| 187 | + benchmark: |
| 188 | + begin: false |
| 189 | + tb: |
| 190 | + begin: false |
| 191 | + fuzz: |
| 192 | + begin: false |
| 193 | + |
| 194 | +linters: |
| 195 | + enable: |
| 196 | + - copyloopvar |
| 197 | + - decorder |
| 198 | + - depguard |
| 199 | + - errcheck |
| 200 | + - errorlint |
| 201 | + - exhaustive |
| 202 | + - gci |
| 203 | + - gocritic |
| 204 | + - gofmt |
| 205 | + - goimports |
| 206 | + - gosec |
| 207 | + - govet |
| 208 | + - misspell |
| 209 | + - nolintlint |
| 210 | + - predeclared |
| 211 | + - reassign |
| 212 | + - revive |
| 213 | + - staticcheck |
| 214 | + - tenv |
| 215 | + - testifylint |
| 216 | + - thelper |
| 217 | + - unconvert |
| 218 | + - unparam |
| 219 | + - unused |
| 220 | + - usestdlibvars |
| 221 | + - wastedassign |
| 222 | + - whitespace |
| 223 | + |
| 224 | +issues: |
| 225 | + # Excluding configuration per-path, per-linter, per-text and per-source |
| 226 | + exclude-rules: |
| 227 | + - text: "G404:" |
| 228 | + linters: |
| 229 | + - gosec |
| 230 | + - text: "G402:" |
| 231 | + linters: |
| 232 | + - gosec |
| 233 | + - text: "G115:" |
| 234 | + linters: |
| 235 | + - gosec |
| 236 | + - path: "pagefile.go" # This exclusion is required for Windows only |
| 237 | + text: "cachedBytes" |
| 238 | + linters: |
| 239 | + - unused |
0 commit comments