fix(lint): migrate golangci-lint config to v2 schema
- commit
- e81db1c93af2eb8ff2063b802fa744ea5c3a46d4
- author
- bnema · · 2025-11-29 18:56 UTC
- parent
- 60a1be3
- signature
- unsigned
1 file · +107 -116
M .golangci.yml +107 -116
| @@ -3,126 +3,117 @@ version: "2" | |||
| 3 | 3 | linters: | |
| 4 | 4 | default: none | |
| 5 | 5 | enable: | |
| 6 | - | - bodyclose # checks whether HTTP response body is closed successfully | |
| 7 | - | - copyloopvar # detects places where loop variables are copied | |
| 8 | - | # - depguard # checks for unwanted dependencies (disabled for CLI apps) | |
| 9 | - | - dogsled # checks assignments with too many blank identifiers | |
| 10 | - | - dupl # tool for code clone detection | |
| 11 | - | - errcheck # checking for unchecked errors | |
| 12 | - | - errorlint # errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme | |
| 13 | - | - funlen # tool for detection of long functions | |
| 14 | - | - gocheckcompilerdirectives # validates go compiler directive comments (//go:) | |
| 15 | - | # - gochecknoinits # checks that no init functions are present in Go code (disabled for CLI apps) | |
| 16 | - | - goconst # finds repeated strings that could be replaced by a constant | |
| 17 | - | - gocritic # provides diagnostics that check for bugs, performance and style issues | |
| 18 | - | - gocyclo # computes and checks the cyclomatic complexity of functions | |
| 19 | - | - godox # tool for detection of FIXME, TODO and other comment keywords | |
| 20 | - | - mnd # detects magic numbers | |
| 21 | - | - goprintffuncname # checks that printf-like functions are named with `f` at the end | |
| 22 | - | - gosec # inspects source code for security problems | |
| 23 | - | - govet # examines Go source code and reports suspicious constructs | |
| 24 | - | - ineffassign # detects when assignments to existing variables are not used | |
| 25 | - | - lll # reports long lines | |
| 26 | - | - misspell # finds commonly misspelled English words in comments | |
| 27 | - | - nakedret # finds naked returns in functions greater than a specified function length | |
| 28 | - | - nolintlint # reports ill-formed or insufficient nolint directives | |
| 29 | - | - revive # fast, configurable, extensible, flexible, and beautiful linter for Go | |
| 30 | - | - staticcheck # advanced Go linter | |
| 31 | - | - testifylint # checks usage of github.com/stretchr/testify | |
| 32 | - | - unconvert # removes unnecessary type conversions | |
| 33 | - | - unparam # reports unused function parameters | |
| 34 | - | - unused # checks for unused constants, variables, functions and types | |
| 35 | - | - whitespace # detects leading and trailing whitespace | |
| 6 | + | - bodyclose | |
| 7 | + | - copyloopvar | |
| 8 | + | - dogsled | |
| 9 | + | - dupl | |
| 10 | + | - errcheck | |
| 11 | + | - errorlint | |
| 12 | + | - funlen | |
| 13 | + | - gocheckcompilerdirectives | |
| 14 | + | - goconst | |
| 15 | + | - gocritic | |
| 16 | + | - gocyclo | |
| 17 | + | - godox | |
| 18 | + | - mnd | |
| 19 | + | - goprintffuncname | |
| 20 | + | - gosec | |
| 21 | + | - govet | |
| 22 | + | - ineffassign | |
| 23 | + | - lll | |
| 24 | + | - misspell | |
| 25 | + | - nakedret | |
| 26 | + | - nolintlint | |
| 27 | + | - revive | |
| 28 | + | - staticcheck | |
| 29 | + | - testifylint | |
| 30 | + | - unconvert | |
| 31 | + | - unparam | |
| 32 | + | - unused | |
| 33 | + | - whitespace | |
| 36 | 34 | ||
| 37 | - | linters-settings: | |
| 38 | - | dupl: | |
| 39 | - | threshold: 100 | |
| 40 | - | funlen: | |
| 41 | - | lines: -1 # don't check line count | |
| 42 | - | statements: 50 | |
| 43 | - | goconst: | |
| 44 | - | min-len: 2 | |
| 45 | - | min-occurrences: 3 | |
| 46 | - | gocritic: | |
| 47 | - | enabled-tags: | |
| 48 | - | - diagnostic | |
| 49 | - | - experimental | |
| 50 | - | - opinionated | |
| 51 | - | - performance | |
| 52 | - | - style | |
| 53 | - | disabled-checks: | |
| 54 | - | - dupImport | |
| 55 | - | - ifElseChain | |
| 56 | - | - octalLiteral | |
| 57 | - | - whyNoLint | |
| 58 | - | gocyclo: | |
| 59 | - | min-complexity: 15 | |
| 60 | - | godox: | |
| 61 | - | keywords: | |
| 62 | - | - FIXME | |
| 63 | - | - TODO | |
| 64 | - | - BUG | |
| 65 | - | mnd: | |
| 66 | - | checks: | |
| 67 | - | - argument | |
| 68 | - | - case | |
| 69 | - | - condition | |
| 70 | - | - return | |
| 71 | - | ignored-numbers: | |
| 72 | - | - '0' | |
| 73 | - | - '1' | |
| 74 | - | - '2' | |
| 75 | - | - '3' | |
| 76 | - | ignored-functions: | |
| 77 | - | - strings.SplitN | |
| 78 | - | govet: | |
| 79 | - | enable: | |
| 80 | - | - nilness | |
| 81 | - | - shadow | |
| 82 | - | errorlint: | |
| 83 | - | asserts: false | |
| 84 | - | lll: | |
| 85 | - | line-length: 120 | |
| 86 | - | misspell: | |
| 87 | - | locale: US | |
| 88 | - | nolintlint: | |
| 89 | - | allow-unused: false | |
| 90 | - | require-explanation: true | |
| 91 | - | require-specific: true | |
| 92 | - | revive: | |
| 93 | - | rules: | |
| 94 | - | - name: indent-error-flow | |
| 95 | - | - name: unused-parameter | |
| 96 | - | - name: unused-receiver | |
| 35 | + | settings: | |
| 36 | + | dupl: | |
| 37 | + | threshold: 100 | |
| 38 | + | funlen: | |
| 39 | + | lines: -1 | |
| 40 | + | statements: 50 | |
| 41 | + | goconst: | |
| 42 | + | min-len: 2 | |
| 43 | + | min-occurrences: 3 | |
| 44 | + | gocritic: | |
| 45 | + | enabled-tags: | |
| 46 | + | - diagnostic | |
| 47 | + | - experimental | |
| 48 | + | - opinionated | |
| 49 | + | - performance | |
| 50 | + | - style | |
| 51 | + | disabled-checks: | |
| 52 | + | - dupImport | |
| 53 | + | - ifElseChain | |
| 54 | + | - octalLiteral | |
| 55 | + | - whyNoLint | |
| 56 | + | gocyclo: | |
| 57 | + | min-complexity: 15 | |
| 58 | + | godox: | |
| 59 | + | keywords: | |
| 60 | + | - FIXME | |
| 61 | + | - TODO | |
| 62 | + | - BUG | |
| 63 | + | mnd: | |
| 64 | + | checks: | |
| 65 | + | - argument | |
| 66 | + | - case | |
| 67 | + | - condition | |
| 68 | + | - return | |
| 69 | + | ignored-numbers: | |
| 70 | + | - '0' | |
| 71 | + | - '1' | |
| 72 | + | - '2' | |
| 73 | + | - '3' | |
| 74 | + | ignored-functions: | |
| 75 | + | - strings.SplitN | |
| 76 | + | govet: | |
| 77 | + | enable: | |
| 78 | + | - nilness | |
| 79 | + | - shadow | |
| 80 | + | errorlint: | |
| 81 | + | asserts: false | |
| 82 | + | lll: | |
| 83 | + | line-length: 120 | |
| 84 | + | misspell: | |
| 85 | + | locale: US | |
| 86 | + | nolintlint: | |
| 87 | + | allow-unused: false | |
| 88 | + | require-explanation: true | |
| 89 | + | require-specific: true | |
| 90 | + | revive: | |
| 91 | + | rules: | |
| 92 | + | - name: indent-error-flow | |
| 93 | + | - name: unused-parameter | |
| 94 | + | - name: unused-receiver | |
| 97 | 95 | ||
| 98 | - | issues: | |
| 99 | - | exclude-rules: | |
| 100 | - | # Exclude some linters from running on tests files | |
| 101 | - | - path: _test\.go | |
| 102 | - | linters: | |
| 103 | - | - dupl | |
| 104 | - | - mnd | |
| 105 | - | - lll | |
| 106 | - | - funlen | |
| 107 | - | ||
| 108 | - | # Exclude SQLC generated files from linting | |
| 109 | - | - path: internal/db/.*\.sql\.go | |
| 110 | - | linters: | |
| 111 | - | - all | |
| 112 | - | ||
| 113 | - | # Exclude SQLC generated models from some linters | |
| 114 | - | - path: internal/db/models\.go | |
| 115 | - | linters: | |
| 116 | - | - unused | |
| 117 | - | - deadcode | |
| 118 | - | ||
| 119 | - | # Allow long lines in generated code | |
| 120 | - | - path: internal/db/ | |
| 121 | - | linters: | |
| 122 | - | - lll | |
| 96 | + | exclusions: | |
| 97 | + | generated: lax | |
| 98 | + | rules: | |
| 99 | + | - path: _test\.go | |
| 100 | + | linters: | |
| 101 | + | - dupl | |
| 102 | + | - mnd | |
| 103 | + | - lll | |
| 104 | + | - funlen | |
| 105 | + | - path: internal/db/.*\.sql\.go | |
| 106 | + | linters: | |
| 107 | + | - all | |
| 108 | + | - path: internal/db/models\.go | |
| 109 | + | linters: | |
| 110 | + | - unused | |
| 111 | + | - path: internal/db/ | |
| 112 | + | linters: | |
| 113 | + | - lll | |
| 123 | 114 | ||
| 124 | 115 | run: | |
| 125 | 116 | timeout: 5m | |
| 126 | 117 | modules-download-mode: readonly | |
| 127 | 118 | build-tags: | |
| 128 | - | - webkit_cgo⏎̸ | |
| 119 | + | - webkit_cgo | |
| @@ -3,126 +3,117 @@ version: "2" | |||||
| 3 | linters: | 3 | linters: | ||
| 4 | default: none | 4 | default: none | ||
| 5 | enable: | 5 | enable: | ||
| 6 | - | - bodyclose # checks whether HTTP response body is closed successfully | 6 | + | - bodyclose |
| 7 | - | - copyloopvar # detects places where loop variables are copied | 7 | + | - copyloopvar |
| 8 | - | # - depguard # checks for unwanted dependencies (disabled for CLI apps) | 8 | + | - dogsled |
| 9 | - | - dogsled # checks assignments with too many blank identifiers | 9 | + | - dupl |
| 10 | - | - dupl # tool for code clone detection | 10 | + | - errcheck |
| 11 | - | - errcheck # checking for unchecked errors | 11 | + | - errorlint |
| 12 | - | - errorlint # errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme | 12 | + | - funlen |
| 13 | - | - funlen # tool for detection of long functions | 13 | + | - gocheckcompilerdirectives |
| 14 | - | - gocheckcompilerdirectives # validates go compiler directive comments (//go:) | 14 | + | - goconst |
| 15 | - | # - gochecknoinits # checks that no init functions are present in Go code (disabled for CLI apps) | 15 | + | - gocritic |
| 16 | - | - goconst # finds repeated strings that could be replaced by a constant | 16 | + | - gocyclo |
| 17 | - | - gocritic # provides diagnostics that check for bugs, performance and style issues | 17 | + | - godox |
| 18 | - | - gocyclo # computes and checks the cyclomatic complexity of functions | 18 | + | - mnd |
| 19 | - | - godox # tool for detection of FIXME, TODO and other comment keywords | 19 | + | - goprintffuncname |
| 20 | - | - mnd # detects magic numbers | 20 | + | - gosec |
| 21 | - | - goprintffuncname # checks that printf-like functions are named with `f` at the end | 21 | + | - govet |
| 22 | - | - gosec # inspects source code for security problems | 22 | + | - ineffassign |
| 23 | - | - govet # examines Go source code and reports suspicious constructs | 23 | + | - lll |
| 24 | - | - ineffassign # detects when assignments to existing variables are not used | 24 | + | - misspell |
| 25 | - | - lll # reports long lines | 25 | + | - nakedret |
| 26 | - | - misspell # finds commonly misspelled English words in comments | 26 | + | - nolintlint |
| 27 | - | - nakedret # finds naked returns in functions greater than a specified function length | 27 | + | - revive |
| 28 | - | - nolintlint # reports ill-formed or insufficient nolint directives | 28 | + | - staticcheck |
| 29 | - | - revive # fast, configurable, extensible, flexible, and beautiful linter for Go | 29 | + | - testifylint |
| 30 | - | - staticcheck # advanced Go linter | 30 | + | - unconvert |
| 31 | - | - testifylint # checks usage of github.com/stretchr/testify | 31 | + | - unparam |
| 32 | - | - unconvert # removes unnecessary type conversions | 32 | + | - unused |
| 33 | - | - unparam # reports unused function parameters | 33 | + | - whitespace |
| 34 | - | - unused # checks for unused constants, variables, functions and types | |||
| 35 | - | - whitespace # detects leading and trailing whitespace | |||
| 36 | 34 | ||||
| 37 | - | linters-settings: | 35 | + | settings: |
| 38 | - | dupl: | 36 | + | dupl: |
| 39 | - | threshold: 100 | 37 | + | threshold: 100 |
| 40 | - | funlen: | 38 | + | funlen: |
| 41 | - | lines: -1 # don't check line count | 39 | + | lines: -1 |
| 42 | - | statements: 50 | 40 | + | statements: 50 |
| 43 | - | goconst: | 41 | + | goconst: |
| 44 | - | min-len: 2 | 42 | + | min-len: 2 |
| 45 | - | min-occurrences: 3 | 43 | + | min-occurrences: 3 |
| 46 | - | gocritic: | 44 | + | gocritic: |
| 47 | - | enabled-tags: | 45 | + | enabled-tags: |
| 48 | - | - diagnostic | 46 | + | - diagnostic |
| 49 | - | - experimental | 47 | + | - experimental |
| 50 | - | - opinionated | 48 | + | - opinionated |
| 51 | - | - performance | 49 | + | - performance |
| 52 | - | - style | 50 | + | - style |
| 53 | - | disabled-checks: | 51 | + | disabled-checks: |
| 54 | - | - dupImport | 52 | + | - dupImport |
| 55 | - | - ifElseChain | 53 | + | - ifElseChain |
| 56 | - | - octalLiteral | 54 | + | - octalLiteral |
| 57 | - | - whyNoLint | 55 | + | - whyNoLint |
| 58 | - | gocyclo: | 56 | + | gocyclo: |
| 59 | - | min-complexity: 15 | 57 | + | min-complexity: 15 |
| 60 | - | godox: | 58 | + | godox: |
| 61 | - | keywords: | 59 | + | keywords: |
| 62 | - | - FIXME | 60 | + | - FIXME |
| 63 | - | - TODO | 61 | + | - TODO |
| 64 | - | - BUG | 62 | + | - BUG |
| 65 | - | mnd: | 63 | + | mnd: |
| 66 | - | checks: | 64 | + | checks: |
| 67 | - | - argument | 65 | + | - argument |
| 68 | - | - case | 66 | + | - case |
| 69 | - | - condition | 67 | + | - condition |
| 70 | - | - return | 68 | + | - return |
| 71 | - | ignored-numbers: | 69 | + | ignored-numbers: |
| 72 | - | - '0' | 70 | + | - '0' |
| 73 | - | - '1' | 71 | + | - '1' |
| 74 | - | - '2' | 72 | + | - '2' |
| 75 | - | - '3' | 73 | + | - '3' |
| 76 | - | ignored-functions: | 74 | + | ignored-functions: |
| 77 | - | - strings.SplitN | 75 | + | - strings.SplitN |
| 78 | - | govet: | 76 | + | govet: |
| 79 | - | enable: | 77 | + | enable: |
| 80 | - | - nilness | 78 | + | - nilness |
| 81 | - | - shadow | 79 | + | - shadow |
| 82 | - | errorlint: | 80 | + | errorlint: |
| 83 | - | asserts: false | 81 | + | asserts: false |
| 84 | - | lll: | 82 | + | lll: |
| 85 | - | line-length: 120 | 83 | + | line-length: 120 |
| 86 | - | misspell: | 84 | + | misspell: |
| 87 | - | locale: US | 85 | + | locale: US |
| 88 | - | nolintlint: | 86 | + | nolintlint: |
| 89 | - | allow-unused: false | 87 | + | allow-unused: false |
| 90 | - | require-explanation: true | 88 | + | require-explanation: true |
| 91 | - | require-specific: true | 89 | + | require-specific: true |
| 92 | - | revive: | 90 | + | revive: |
| 93 | - | rules: | 91 | + | rules: |
| 94 | - | - name: indent-error-flow | 92 | + | - name: indent-error-flow |
| 95 | - | - name: unused-parameter | 93 | + | - name: unused-parameter |
| 96 | - | - name: unused-receiver | 94 | + | - name: unused-receiver |
| 97 | 95 | ||||
| 98 | - | issues: | 96 | + | exclusions: |
| 99 | - | exclude-rules: | 97 | + | generated: lax |
| 100 | - | # Exclude some linters from running on tests files | 98 | + | rules: |
| 101 | - | - path: _test\.go | 99 | + | - path: _test\.go |
| 102 | - | linters: | 100 | + | linters: |
| 103 | - | - dupl | 101 | + | - dupl |
| 104 | - | - mnd | 102 | + | - mnd |
| 105 | - | - lll | 103 | + | - lll |
| 106 | - | - funlen | 104 | + | - funlen |
| 107 | - | 105 | + | - path: internal/db/.*\.sql\.go | |
| 108 | - | # Exclude SQLC generated files from linting | 106 | + | linters: |
| 109 | - | - path: internal/db/.*\.sql\.go | 107 | + | - all |
| 110 | - | linters: | 108 | + | - path: internal/db/models\.go |
| 111 | - | - all | 109 | + | linters: |
| 112 | - | 110 | + | - unused | |
| 113 | - | # Exclude SQLC generated models from some linters | 111 | + | - path: internal/db/ |
| 114 | - | - path: internal/db/models\.go | 112 | + | linters: |
| 115 | - | linters: | 113 | + | - lll |
| 116 | - | - unused | |||
| 117 | - | - deadcode | |||
| 118 | - | ||||
| 119 | - | # Allow long lines in generated code | |||
| 120 | - | - path: internal/db/ | |||
| 121 | - | linters: | |||
| 122 | - | - lll | |||
| 123 | 114 | ||||
| 124 | run: | 115 | run: | ||
| 125 | timeout: 5m | 116 | timeout: 5m | ||
| 126 | modules-download-mode: readonly | 117 | modules-download-mode: readonly | ||
| 127 | build-tags: | 118 | build-tags: | ||
| 128 | - | - webkit_cgo⏎̸ | 119 | + | - webkit_cgo |