Files
beads/.golangci.yml
Joshua Shanks cf4f11cff7 Fix error handling consistency in auto-import and fallback paths (#47)
* Fix error handling consistency in auto-import and fallback paths

- Add error checking/warnings for auto-import CRUD operations (UpdateIssue, CreateIssue, AddDependency)
- Add error checking/warnings for auto-import label operations (AddLabel, RemoveLabel)
- Add warning when import hash storage fails (prevents unnecessary re-imports)
- Add proper error handling for UserHomeDir with fallback to current directory

These changes make auto-import error handling consistent with manual operations
and prevent silent failures that could confuse users or cause data inconsistencies.

* Remove invalid version property from golangci-lint config

* Fix linter errors: errcheck, unused, goconst, and misspell

- Fix unchecked error returns in ROLLBACK statements
- Fix unchecked type assertion for status field
- Extract LIMIT SQL constant to reduce duplication
- Fix spelling: cancelled -> canceled
- Remove unused ensureCounterInitialized function
- Remove unused parameter in parallel test goroutine
2025-10-15 23:34:33 -07:00

89 lines
2.5 KiB
YAML

# golangci-lint configuration for beads
# See https://golangci-lint.run/usage/configuration/
run:
timeout: 5m
tests: true
linters:
enable:
# Core linters (always available)
- errcheck # Check for unchecked errors
- govet # Go vet
- ineffassign # Detect ineffectual assignments
- staticcheck # Static analysis
- unused # Find unused code
# Additional linters
- revive # Fast, configurable, extensible linter
- misspell # Fix commonly misspelled English words
- unconvert # Remove unnecessary type conversions
- unparam # Find unused function parameters
- goconst # Find repeated strings that could be constants
- gocyclo # Check cyclomatic complexity
- dupl # Find duplicated code
- gosec # Security-focused linter
linters-settings:
errcheck:
check-type-assertions: true
check-blank: false
exclude-functions:
- (*database/sql.DB).Close
- (*database/sql.Rows).Close
- (*database/sql.Tx).Rollback
gocyclo:
min-complexity: 15
goconst:
min-len: 3
min-occurrences: 3
dupl:
threshold: 100
misspell:
locale: US
revive:
rules:
- name: var-naming
- name: exported
issues:
max-issues-per-linter: 0
max-same-issues: 0
# Exclude known false positives and idiomatic patterns
exclude:
# Idiomatic Go: ignoring errors from defer cleanup
- "Error return value.*\\.Close.*is not checked"
- "Error return value.*\\.Rollback.*is not checked"
- "Error return value.*\\.RemoveAll.*is not checked"
# 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