|
1 | | -# yaml-language-server: $schema=https://golangci-lint.run/jsonschema/golangci.jsonschema.json |
| 1 | +# yaml-language-server: https://raw.githubusercontent.com/golangci/golangci-lint/refs/heads/main/jsonschema/golangci.jsonschema.json |
2 | 2 |
|
3 | 3 | # https://golangci-lint.run/usage/configuration/ |
4 | 4 | # https://golangci-lint.run/usage/linters/ |
| 5 | +# https://ldez.github.io/blog/2025/03/23/golangci-lint-v2/ |
5 | 6 |
|
| 7 | +version: "2" |
6 | 8 | run: |
7 | | - go: '1.24' |
8 | | - timeout: 10m |
9 | | - issues-exit-code: 1 |
10 | | - tests: true |
| 9 | + go: "1.24" |
11 | 10 | build-tags: |
12 | 11 | - integration |
13 | 12 | modules-download-mode: readonly |
14 | | - |
| 13 | + issues-exit-code: 1 |
| 14 | + tests: true |
15 | 15 | output: |
16 | 16 | formats: |
17 | | - - format: colored-line-number |
| 17 | + text: |
18 | 18 | path: stderr |
19 | | - print-issued-lines: true |
20 | | - print-linter-name: true |
21 | | - |
| 19 | + print-linter-name: true |
| 20 | + print-issued-lines: true |
| 21 | + colors: true |
22 | 22 | linters: |
23 | | - enable-all: true |
| 23 | + default: all |
| 24 | + |
24 | 25 | disable: |
25 | | - - tenv # deprecated |
26 | | - - exhaustruct # TODO: reconsider |
27 | | - - depguard # TODO: reconsider |
28 | | - - funlen # TODO: reconsider |
29 | | - - wsl |
| 26 | + - cyclop |
| 27 | + - depguard |
| 28 | + - dupl |
| 29 | + - exhaustive |
| 30 | + - exhaustruct |
| 31 | + - funlen |
| 32 | + - gochecknoglobals |
| 33 | + - gocognit |
| 34 | + - godot |
| 35 | + - godox |
30 | 36 | - lll |
31 | | - - wrapcheck |
32 | | - - varnamelen |
| 37 | + - mnd |
| 38 | + - nlreturn |
33 | 39 | - nonamedreturns |
| 40 | + - perfsprint |
| 41 | + - tagliatelle |
34 | 42 | - testpackage |
35 | | - - godox |
36 | | - - godot |
37 | | - - gochecknoglobals |
38 | | - - mnd |
39 | | - |
40 | | -issues: |
41 | | - # https://golangci-lint.run/usage/false-positives/#default-exclusions |
42 | | - exclude-use-default: true |
43 | | - include: |
44 | | - - EXC0004 |
45 | | - - EXC0005 |
46 | | - - EXC0006 |
47 | | - exclude-rules: |
48 | | - - path: '(.+)_test\.go' |
49 | | - linters: [gochecknoglobals, goconst, goerr113, dupl, maintidx] |
50 | | - - path: '(.+)_test\.go' |
51 | | - linters: [govet] |
52 | | - text: 'fieldalignment:' |
53 | | - |
54 | | -linters-settings: |
55 | | - # https://golangci-lint.run/usage/linters/#unused |
56 | | - unused: |
57 | | - field-writes-are-uses: false |
58 | | - post-statements-are-reads: false |
59 | | - exported-fields-are-used: true |
60 | | - parameters-are-used: true |
61 | | - local-variables-are-used: false |
62 | | - generated-is-used: true |
63 | | - |
64 | | - # https://golangci-lint.run/usage/linters/#tagliatelle |
65 | | - tagliatelle: |
66 | | - case: |
67 | | - use-field-name: true |
| 43 | + - unparam |
| 44 | + - varnamelen |
| 45 | + - wrapcheck |
| 46 | + - wsl |
| 47 | + - funcorder |
| 48 | + |
| 49 | + settings: |
| 50 | + staticcheck: |
| 51 | + checks: ["all", "-QF1008"] |
| 52 | + nlreturn: |
| 53 | + block-size: 3 |
| 54 | + nolintlint: |
| 55 | + allow-unused: true |
| 56 | + paralleltest: |
| 57 | + ignore-missing: true |
| 58 | + ignore-missing-subtests: true |
| 59 | + revive: |
| 60 | + severity: error |
| 61 | + enable-all-rules: false |
68 | 62 | rules: |
69 | | - # Any struct tag type can be used. |
70 | | - # Support string case: `camel`, `pascal`, `kebab`, `snake`, `goCamel`, `goPascal`, `goKebab`, `goSnake`, `upper`, `lower` |
71 | | - json: snake |
72 | | - yaml: camel |
73 | | - xml: camel |
74 | | - bson: camel |
75 | | - avro: snake |
76 | | - mapstructure: kebab |
77 | | - |
78 | | - # https://golangci-lint.run/usage/linters/#paralleltest |
79 | | - paralleltest: |
80 | | - ignore-missing: true |
81 | | - ignore-missing-subtests: true |
82 | | - |
83 | | - # https://golangci-lint.run/usage/linters/#nolintlint |
84 | | - nolintlint: |
85 | | - # Disable to ensure that all nolint directives actually have an effect. |
86 | | - # Default: false |
87 | | - allow-unused: true |
88 | | - |
89 | | - # https://golangci-lint.run/usage/linters/#nlreturn |
90 | | - nlreturn: |
91 | | - block-size: 3 |
92 | | - |
93 | | - # https://golangci-lint.run/usage/linters/#cyclop |
94 | | - cyclop: |
95 | | - max-complexity: 20 |
96 | | - package-average: 0.0 |
97 | | - skip-tests: true |
98 | | - |
99 | | - # https://golangci-lint.run/usage/linters/#gocyclo |
100 | | - gocyclo: |
101 | | - min-complexity: 40 |
102 | | - |
103 | | - # https://golangci-lint.run/usage/linters/#maintidx |
104 | | - maintidx: |
105 | | - under: 10 |
106 | | - |
107 | | - # https://golangci-lint.run/usage/linters/#govet |
108 | | - govet: |
109 | | - enable-all: true |
110 | | - settings: |
111 | | - shadow: |
112 | | - strict: false |
113 | | - #disable: |
114 | | - # - fieldalignment |
115 | | - |
116 | | - # https://golangci-lint.run/usage/linters/#prealloc |
117 | | - prealloc: |
118 | | - simple: true |
119 | | - range-loops: true |
120 | | - for-loops: true |
121 | | - |
122 | | - sloglint: |
123 | | - attr-only: true |
124 | | - no-global: "all" |
125 | | - context: "scope" # report only if a context exists in the scope of the outermost function |
126 | | - static-msg: true |
127 | | - key-naming-case: snake # Values: snake, kebab, camel, pascal |
128 | | - forbidden-keys: |
129 | | - - msg |
| 63 | + - name: unused-parameter |
| 64 | + disabled: true |
| 65 | + tagliatelle: |
| 66 | + case: |
| 67 | + rules: |
| 68 | + avro: snake |
| 69 | + bson: camel |
| 70 | + json: snake |
| 71 | + mapstructure: kebab |
| 72 | + xml: camel |
| 73 | + yaml: camel |
| 74 | + use-field-name: true |
| 75 | + |
| 76 | + exclusions: |
| 77 | + generated: lax |
| 78 | + presets: |
| 79 | + - comments |
| 80 | + - std-error-handling |
| 81 | + rules: |
| 82 | + - linters: |
| 83 | + - dupl |
| 84 | + - err113 |
| 85 | + - gochecknoglobals |
| 86 | + - goconst |
| 87 | + - maintidx |
| 88 | + path: (.+)_test\.go |
| 89 | + - linters: |
| 90 | + - govet |
| 91 | + path: (.+)_test\.go |
| 92 | + text: 'fieldalignment:' |
| 93 | + - linters: |
| 94 | + - dupl |
| 95 | + - err113 |
| 96 | + - gochecknoglobals |
| 97 | + - goconst |
| 98 | + - maintidx |
| 99 | + path: internal/tesatingx/testdata |
| 100 | + paths: |
| 101 | + - third_party$ |
| 102 | + - builtin$ |
| 103 | + - examples$ |
| 104 | + |
| 105 | +# https://golangci-lint.run/usage/formatters/ |
| 106 | +# https://golangci-lint.run/usage/configuration/#formatters-configuration |
| 107 | +formatters: |
| 108 | + enable: |
| 109 | + - gci |
| 110 | + - gofmt |
| 111 | + - gofumpt |
| 112 | + - goimports |
| 113 | + #- golines |
| 114 | + exclusions: |
| 115 | + generated: lax |
0 commit comments