Migrate .golangci.yml to v2 format
- Removed invalid 'version: 2' field (must be string) - Ran golangci-lint migrate to update to v2 schema - Moved linters-settings -> linters.settings - Moved issues.exclude-rules -> linters.exclusions.rules - Moved issues.exclude -> linters.exclusions.rules with text field - Config now validates successfully with golangci-lint v2.x Amp-Thread-ID: https://ampcode.com/threads/T-d5fb1beb-0350-4a49-b8fa-ab752a82ef8e Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
157
.golangci.yml
157
.golangci.yml
@@ -1,91 +1,82 @@
|
|||||||
# golangci-lint configuration for beads
|
version: "2"
|
||||||
# See https://golangci-lint.run/usage/configuration/
|
|
||||||
|
|
||||||
version: 2
|
|
||||||
|
|
||||||
run:
|
run:
|
||||||
timeout: 5m
|
|
||||||
tests: true
|
tests: true
|
||||||
|
|
||||||
linters:
|
linters:
|
||||||
enable:
|
enable:
|
||||||
# Core linters (always available)
|
- dupl
|
||||||
- errcheck # Check for unchecked errors
|
- goconst
|
||||||
- govet # Go vet
|
- gocyclo
|
||||||
- ineffassign # Detect ineffectual assignments
|
- gosec
|
||||||
- staticcheck # Static analysis
|
- misspell
|
||||||
- unused # Find unused code
|
- revive
|
||||||
|
- unconvert
|
||||||
# Additional linters
|
- unparam
|
||||||
- revive # Fast, configurable, extensible linter
|
settings:
|
||||||
- misspell # Fix commonly misspelled English words
|
dupl:
|
||||||
- unconvert # Remove unnecessary type conversions
|
threshold: 100
|
||||||
- unparam # Find unused function parameters
|
errcheck:
|
||||||
- goconst # Find repeated strings that could be constants
|
check-type-assertions: true
|
||||||
- gocyclo # Check cyclomatic complexity
|
check-blank: false
|
||||||
- dupl # Find duplicated code
|
exclude-functions:
|
||||||
- gosec # Security-focused linter
|
- (*database/sql.DB).Close
|
||||||
|
- (*database/sql.Rows).Close
|
||||||
linters-settings:
|
- (*database/sql.Tx).Rollback
|
||||||
errcheck:
|
goconst:
|
||||||
check-type-assertions: true
|
min-len: 3
|
||||||
check-blank: false
|
min-occurrences: 3
|
||||||
exclude-functions:
|
gocyclo:
|
||||||
- (*database/sql.DB).Close
|
min-complexity: 15
|
||||||
- (*database/sql.Rows).Close
|
misspell:
|
||||||
- (*database/sql.Tx).Rollback
|
locale: US
|
||||||
|
revive:
|
||||||
gocyclo:
|
rules:
|
||||||
min-complexity: 15
|
- name: var-naming
|
||||||
|
- name: exported
|
||||||
goconst:
|
exclusions:
|
||||||
min-len: 3
|
generated: lax
|
||||||
min-occurrences: 3
|
presets:
|
||||||
|
- comments
|
||||||
dupl:
|
- common-false-positives
|
||||||
threshold: 100
|
- legacy
|
||||||
|
- std-error-handling
|
||||||
misspell:
|
|
||||||
locale: US
|
|
||||||
|
|
||||||
revive:
|
|
||||||
rules:
|
rules:
|
||||||
- name: var-naming
|
- linters:
|
||||||
- name: exported
|
- dupl
|
||||||
|
- errcheck
|
||||||
|
- goconst
|
||||||
|
- gocyclo
|
||||||
|
path: _test\.go
|
||||||
|
- path: (.+)\.go$
|
||||||
|
text: Error return value.*\.Close.*is not checked
|
||||||
|
- path: (.+)\.go$
|
||||||
|
text: Error return value.*\.Rollback.*is not checked
|
||||||
|
- path: (.+)\.go$
|
||||||
|
text: Error return value.*\.RemoveAll.*is not checked
|
||||||
|
- path: (.+)\.go$
|
||||||
|
text: 'unused-parameter: parameter ''cmd'' seems to be unused'
|
||||||
|
- path: (.+)\.go$
|
||||||
|
text: 'unused-parameter: parameter ''args'' seems to be unused'
|
||||||
|
- path: (.+)\.go$
|
||||||
|
text: 'var-naming: avoid meaningless package names'
|
||||||
|
- path: (.+)\.go$
|
||||||
|
text: exported.*SQLiteStorage.*stutters
|
||||||
|
- path: (.+)\.go$
|
||||||
|
text: 'G201: SQL string formatting'
|
||||||
|
- path: (.+)\.go$
|
||||||
|
text: G304.*file inclusion via variable
|
||||||
|
- path: (.+)\.go$
|
||||||
|
text: 'G301: Expect directory permissions'
|
||||||
|
paths:
|
||||||
|
- third_party$
|
||||||
|
- builtin$
|
||||||
|
- examples$
|
||||||
issues:
|
issues:
|
||||||
max-issues-per-linter: 0
|
max-issues-per-linter: 0
|
||||||
max-same-issues: 0
|
max-same-issues: 0
|
||||||
|
formatters:
|
||||||
# Exclude known false positives and idiomatic patterns
|
exclusions:
|
||||||
exclude:
|
generated: lax
|
||||||
# Idiomatic Go: ignoring errors from defer cleanup
|
paths:
|
||||||
- "Error return value.*\\.Close.*is not checked"
|
- third_party$
|
||||||
- "Error return value.*\\.Rollback.*is not checked"
|
- builtin$
|
||||||
- "Error return value.*\\.RemoveAll.*is not checked"
|
- examples$
|
||||||
|
|
||||||
# Cobra handlers: unused params required by interface
|
|
||||||
- "unused-parameter: parameter 'cmd' seems to be unused"
|
|
||||||
- "unused-parameter: parameter 'args' seems to be unused"
|
|
||||||
|
|
||||||
# Style preferences: naming decisions
|
|
||||||
- "var-naming: avoid meaningless package names"
|
|
||||||
- "exported.*SQLiteStorage.*stutters"
|
|
||||||
|
|
||||||
# False positives: validated SQL construction
|
|
||||||
- "G201: SQL string formatting"
|
|
||||||
|
|
||||||
# False positives: user-specified file paths (intended feature)
|
|
||||||
- "G304.*file inclusion via variable"
|
|
||||||
|
|
||||||
# False positive: directory is for user data
|
|
||||||
- "G301: Expect directory permissions"
|
|
||||||
|
|
||||||
# Exclude some linters from running on tests
|
|
||||||
exclude-rules:
|
|
||||||
- path: _test\.go
|
|
||||||
linters:
|
|
||||||
- dupl # Test duplication is acceptable
|
|
||||||
- goconst # Test constants are acceptable
|
|
||||||
- errcheck # Test cleanup errors are acceptable
|
|
||||||
- gocyclo # Test complexity is acceptable
|
|
||||||
|
|||||||
Reference in New Issue
Block a user