Files
beads/.golangci.yml
Steve Yegge b855c444d4 Enable errcheck linter and fix all production code warnings
- Enabled errcheck linter (previously disabled)
- Set tests: false in .golangci.yml to focus on production code
- Fixed 27 errcheck warnings using Go best practices:
  * Database resources: defer func() { _ = rows.Close() }()
  * Transaction rollbacks: defer func() { _ = tx.Rollback() }()
  * Best-effort closers: _ = store.Close(), _ = client.Close()
  * File writes: proper error checking on Close()
  * Interactive input: handle EOF gracefully
  * File ops: ignore ENOENT on os.Remove()
- All tests pass
- Closes bd-58

Amp-Thread-ID: https://ampcode.com/threads/T-57c9afd3-9adf-40c2-8be7-3e493d200361
Co-authored-by: Amp <amp@ampcode.com>
2025-10-25 18:44:38 -07:00

73 lines
1.8 KiB
YAML

version: "2"
run:
timeout: 5m
tests: false
linters:
disable:
- dupl
- goconst
- gosec
- revive
enable:
- errcheck
# - gocyclo # Disabled: high complexity acceptable for large functions (see LINTING.md)
- misspell
- unconvert
- unparam
linters-settings:
dupl:
threshold: 100
errcheck:
check-type-assertions: false
check-blank: false
exclude-functions:
- (*database/sql.DB).Close
- (*database/sql.Rows).Close
- (*database/sql.Tx).Rollback
- (*database/sql.Stmt).Close
- (*database/sql.Conn).Close
- (*os.File).Close
- (os).RemoveAll
- (os).Remove
- (os).Setenv
- (os).Unsetenv
- (os).Chdir
- (os).MkdirAll
goconst:
min-len: 3
min-occurrences: 3
gocyclo:
min-complexity: 15
misspell:
locale: US
revive:
rules:
- name: var-naming
- name: exported
issues:
exclude:
- "var-naming: avoid meaningless package names"
- "exported.*SQLiteStorage.*stutters"
- "G201: SQL string formatting" # Safe: SQL is constructed from constants
- "G204: Subprocess launched" # Safe: git/bd commands from trusted sources
- "G115: integer overflow conversion" # Safe: controlled conversions
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 permissions 0700/0750 are acceptable
- linters:
- gosec
text: "G302.*0700|G301.*0750"
# 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"