fix: Update golangci-lint config to v2 format
- Migrate to golangci-lint v2.x config schema - Move settings under linters.settings - Move exclusions under linters.exclusions - Add version: "2" to config - Fix validation errors
This commit is contained in:
107
.golangci.yml
107
.golangci.yml
@@ -1,78 +1,61 @@
|
|||||||
version: 2
|
version: "2"
|
||||||
|
|
||||||
run:
|
run:
|
||||||
timeout: 5m
|
timeout: 5m
|
||||||
tests: false
|
tests: false
|
||||||
|
|
||||||
linters:
|
linters:
|
||||||
disable:
|
default: 'none'
|
||||||
- dupl
|
|
||||||
- goconst
|
|
||||||
- revive
|
|
||||||
enable:
|
enable:
|
||||||
- errcheck
|
- errcheck
|
||||||
- gosec
|
- gosec
|
||||||
# - gocyclo # Disabled: high complexity acceptable for large functions (see LINTING.md)
|
|
||||||
- misspell
|
- misspell
|
||||||
- unconvert
|
- unconvert
|
||||||
- unparam
|
- unparam
|
||||||
|
|
||||||
linters-settings:
|
settings:
|
||||||
dupl:
|
errcheck:
|
||||||
threshold: 100
|
exclude-functions:
|
||||||
errcheck:
|
- (*database/sql.DB).Close
|
||||||
check-type-assertions: false
|
- (*database/sql.Rows).Close
|
||||||
check-blank: false
|
- (*database/sql.Tx).Rollback
|
||||||
exclude-functions:
|
- (*database/sql.Stmt).Close
|
||||||
- (*database/sql.DB).Close
|
- (*database/sql.Conn).Close
|
||||||
- (*database/sql.Rows).Close
|
- (*os.File).Close
|
||||||
- (*database/sql.Tx).Rollback
|
- (os).RemoveAll
|
||||||
- (*database/sql.Stmt).Close
|
- (os).Remove
|
||||||
- (*database/sql.Conn).Close
|
- (os).Setenv
|
||||||
- (*os.File).Close
|
- (os).Unsetenv
|
||||||
- (os).RemoveAll
|
- (os).Chdir
|
||||||
- (os).Remove
|
- (os).MkdirAll
|
||||||
- (os).Setenv
|
misspell:
|
||||||
- (os).Unsetenv
|
locale: US
|
||||||
- (os).Chdir
|
|
||||||
- (os).MkdirAll
|
exclusions:
|
||||||
goconst:
|
|
||||||
min-len: 3
|
|
||||||
min-occurrences: 3
|
|
||||||
gocyclo:
|
|
||||||
min-complexity: 15
|
|
||||||
misspell:
|
|
||||||
locale: US
|
|
||||||
revive:
|
|
||||||
rules:
|
rules:
|
||||||
- name: var-naming
|
# G304: File inclusion via variable in tests is safe (test data)
|
||||||
- name: exported
|
- path: '_test\.go'
|
||||||
|
linters:
|
||||||
|
- gosec
|
||||||
|
text: "G304.*file inclusion via variable"
|
||||||
|
# G302/G306: Directory/file permissions 0700/0750 are acceptable
|
||||||
|
- linters:
|
||||||
|
- gosec
|
||||||
|
text: "G302.*0700|G301.*0750"
|
||||||
|
# G306: Git hooks must be executable (0700)
|
||||||
|
- path: 'cmd/bd/init\.go'
|
||||||
|
linters:
|
||||||
|
- gosec
|
||||||
|
text: "G306.*0700"
|
||||||
|
# G204: Safe subprocess launches (git show, bd daemon)
|
||||||
|
- linters:
|
||||||
|
- gosec
|
||||||
|
text: 'G204.*git.*show|G204.*daemon'
|
||||||
|
# errcheck: Ignore unchecked errors in test files for common cleanup patterns
|
||||||
|
- path: '_test\.go'
|
||||||
|
linters:
|
||||||
|
- errcheck
|
||||||
|
text: "Error return value of .*(Close|Rollback|RemoveAll|Setenv|Unsetenv|Chdir|MkdirAll|Remove|Write|SetReadDeadline|SetDeadline|Start|Stop).* is not checked"
|
||||||
|
|
||||||
issues:
|
issues:
|
||||||
exclude-patterns:
|
uniq-by-line: true
|
||||||
- "var-naming: avoid meaningless package names"
|
|
||||||
- "exported.*SQLiteStorage.*stutters"
|
|
||||||
exclude-rules:
|
|
||||||
# G304: File inclusion via variable in tests is safe (test data)
|
|
||||||
- path: _test\.go
|
|
||||||
linters:
|
|
||||||
- gosec
|
|
||||||
text: "G304.*file inclusion via variable"
|
|
||||||
# G302/G306: Directory/file permissions 0700/0750 are acceptable
|
|
||||||
- linters:
|
|
||||||
- gosec
|
|
||||||
text: "G302.*0700|G301.*0750"
|
|
||||||
# G306: Git hooks must be executable (0700)
|
|
||||||
- path: cmd/bd/init\.go
|
|
||||||
linters:
|
|
||||||
- gosec
|
|
||||||
text: "G306.*0700"
|
|
||||||
# G204: Safe subprocess launches (git show, bd daemon)
|
|
||||||
- linters:
|
|
||||||
- gosec
|
|
||||||
text: 'G204.*git.*show|G204.*daemon'
|
|
||||||
# errcheck: Ignore unchecked errors in test files for common cleanup patterns
|
|
||||||
- path: _test\.go
|
|
||||||
linters:
|
|
||||||
- errcheck
|
|
||||||
text: "Error return value of .*(Close|Rollback|RemoveAll|Setenv|Unsetenv|Chdir|MkdirAll|Remove|Write|SetReadDeadline|SetDeadline|Start|Stop).* is not checked"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user