version: "2"
# errcheck stays ENABLED. We exclude only specific method signatures that are
# universally safe to ignore (defer close on read paths, rollback-after-commit,
# test helpers). Real production error paths must still be checked.
linters:
default: standard
enable:
- cyclop
- depguard
settings:
cyclop:
max-complexity: 15
package-average: 8.0
errcheck:
exclude-functions:
# defer Close() on read-only or already-errored resources — the open
# error and read errors are what matter; close errors on these paths
# are non-actionable.
- (*database/sql.DB).Close
- (*database/sql.Rows).Close
- (*database/sql.Stmt).Close
# Rollback after a successful Commit is a no-op; rollback on the error
# path can't meaningfully recover either. Idiomatic pattern:
# `defer tx.Rollback()` right after `BeginTx`.
- (*database/sql.Tx).Rollback
# Our wrapper types around database/sql — same semantics as above.
- (*skraak/db.LoggedTx).Rollback
- (*skraak/db.LoggedStmt).Close
# Test cleanup — failures don't affect test validity.
- os.Remove
- os.RemoveAll
depguard:
rules:
# Package dependency rules — see CLAUDE.md "Package Organization"
# Packages may only import packages below them in the list:
# cmd → tools, tui, utils, db
# tools → utils, db
# tui → tools, utils
# db → utils
# utils → (nothing — leaf package)
utils:
files:
- "**/utils/*.go"
deny:
- pkg: "skraak/cmd"
desc: "utils is the leaf package"
- pkg: "skraak/tools"
desc: "utils is the leaf package"
- pkg: "skraak/tui"
desc: "utils is the leaf package"
- pkg: "skraak/db"
desc: "utils is the leaf package"
db:
files:
- "**/db/*.go"
deny:
- pkg: "skraak/cmd"
desc: "db may only import utils"
- pkg: "skraak/tools"
desc: "db may only import utils"
- pkg: "skraak/tui"
desc: "db may only import utils"
tui:
files:
- "**/tui/*.go"
deny:
- pkg: "skraak/cmd"
desc: "tui must not import cmd"
- pkg: "skraak/db"
desc: "tui must not import db"
tools:
files:
- "**/tools/*.go"
deny:
- pkg: "skraak/cmd"
desc: "tools must not import cmd"
- pkg: "skraak/tui"
desc: "tools must not import tui"
exclusions:
rules:
# Test files: binary.Write to in-memory buffers cannot fail; json.Unmarshal
# in assertions is checked by subsequent field reads; tx/stmt calls whose
# results are verified by later queries.
- path: _test\.go
linters:
- errcheck
- cyclop
# Dispatch switches: cyclomatic complexity overcounts these — each case
# is trivially independent, not a branching hazard.
- path: main\.go
linters:
- cyclop
- path: cmd/calls\.go
linters:
- cyclop