|
| 1 | +# Config file version V2 has been introduced, read more in lintersdb. |
| 2 | +# Visit https://golangci-lint.run/usage/configuration/#config-file |
| 3 | +version: "2" |
| 4 | + |
| 5 | +# Settings for the `run` command. |
| 6 | +run: |
| 7 | + # Concurrency defines how many analyses can run simultaneously. |
| 8 | + # Default is 1. |
| 9 | + concurrency: 4 |
| 10 | + # Modules-download-mode specifies how to download modules. |
| 11 | + # Allowed values: readonly, vendor, mod. Default is readonly. |
| 12 | + modules-download-mode: vendor |
| 13 | + |
| 14 | +# Linters configuration. |
1 | 15 | linters: |
2 | 16 | enable: |
3 | 17 | - depguard |
4 | | - - goimports |
5 | 18 | - gosec |
6 | | - - gosimple |
7 | | - - govet |
8 | 19 | - importas |
9 | | - - ineffassign |
10 | 20 | - misspell |
11 | 21 | - revive |
12 | | - - staticcheck |
13 | | - - typecheck |
14 | 22 | - unconvert |
15 | | - - unused |
16 | | - |
17 | 23 | disable: |
18 | 24 | - errcheck |
| 25 | + settings: |
| 26 | + depguard: |
| 27 | + rules: |
| 28 | + main: |
| 29 | + deny: |
| 30 | + - pkg: io/ioutil |
| 31 | + desc: The io/ioutil package has been deprecated, see https://go.dev/doc/go1.16#ioutil |
| 32 | + - pkg: "github.com/stretchr/testify/assert" |
| 33 | + desc: Use "gotest.tools/v3/assert" instead |
| 34 | + - pkg: "github.com/stretchr/testify/require" |
| 35 | + desc: Use "gotest.tools/v3/assert" instead |
| 36 | + - pkg: "github.com/stretchr/testify/suite" |
| 37 | + desc: Do not use |
| 38 | + gosec: |
| 39 | + excludes: |
| 40 | + - G306 # Allow WriteFile permissions to be 0644. |
| 41 | + importas: |
| 42 | + # Do not allow unaliased imports of aliased packages. |
| 43 | + no-unaliased: true |
| 44 | + revive: |
| 45 | + rules: |
| 46 | + - name: package-comments |
| 47 | + disabled: true |
| 48 | + staticcheck: |
| 49 | + # All SA checks are enabled by default, customize as needed. |
| 50 | + # Refer to https://staticcheck.io/docs/checks for check details. |
| 51 | + checks: |
| 52 | + - all |
| 53 | + - '-SA1012' # Allow passing nil contexts. |
| 54 | + - '-ST1003' # Example of disabling another check if needed |
19 | 55 |
|
20 | | - run: |
21 | | - concurrency: 4 |
22 | | - modules-download-mode: vendor |
23 | | - |
24 | | - skip-dirs: |
25 | | - - hack |
26 | | - |
27 | | -linters-settings: |
28 | | - staticcheck: |
29 | | - checks: |
30 | | - - all |
31 | | - - '-SA1012' # Allow passing nil contexts. |
32 | | - |
33 | | - importas: |
34 | | - # Do not allow unaliased imports of aliased packages. |
35 | | - no-unaliased: true |
36 | | - |
37 | | - maligned: |
38 | | - suggest-new: true |
39 | | - |
40 | | - depguard: |
41 | | - rules: |
42 | | - main: |
43 | | - deny: |
44 | | - - pkg: io/ioutil |
45 | | - desc: The io/ioutil package has been deprecated, see https://go.dev/doc/go1.16#ioutil |
46 | | - - pkg: "github.com/stretchr/testify/assert" |
47 | | - desc: Use "gotest.tools/v3/assert" instead |
48 | | - - pkg: "github.com/stretchr/testify/require" |
49 | | - desc: Use "gotest.tools/v3/assert" instead |
50 | | - - pkg: "github.com/stretchr/testify/suite" |
51 | | - desc: Do not use |
52 | | - |
53 | | - revive: |
54 | | - rules: |
55 | | - - name: package-comments |
56 | | - disabled: true |
57 | | - |
58 | | - gosec: |
59 | | - excludes: |
60 | | - - G306 # Allow WriteFile permissions to be 0644. |
| 56 | + # Exclusions based on common patterns and presets. |
| 57 | + exclusions: |
| 58 | + # Treat generated files leniently. |
| 59 | + generated: lax |
| 60 | + # Use predefined sets of common exclusions. |
| 61 | + presets: |
| 62 | + - comments |
| 63 | + - common-false-positives |
| 64 | + - legacy # Excludes checks deprecated in new Go versions |
| 65 | + - std-error-handling # Excludes some common stdlib error patterns |
| 66 | + # Exclude specific paths using regex. |
| 67 | + paths: |
| 68 | + - third_party$ |
| 69 | + - builtin$ |
| 70 | + - examples$ |
61 | 71 |
|
| 72 | +# Issues reporting configuration. |
62 | 73 | issues: |
63 | 74 | # Maximum issues count per one linter. Set to 0 to disable. Default is 50. |
64 | 75 | max-issues-per-linter: 0 |
65 | | - |
66 | 76 | # Maximum count of issues with the same text. Set to 0 to disable. Default is 3. |
67 | 77 | max-same-issues: 0 |
| 78 | + |
| 79 | +# Formatters configuration (new in V2). |
| 80 | +formatters: |
| 81 | + enable: |
| 82 | + - goimports # Enable goimports as a formatter. |
| 83 | + exclusions: |
| 84 | + # Treat generated files leniently for formatting. |
| 85 | + generated: lax |
| 86 | + # Exclude specific paths from formatting using regex. |
| 87 | + paths: |
| 88 | + - third_party$ |
| 89 | + - builtin$ |
| 90 | + - examples$ |
0 commit comments