textmachine/platform/.golangci.yml

64 lines
2.1 KiB
YAML

# golangci-lint configuration for the platform module. Pinned to 2.12.2 (Makefile enforces it):
# findings are version-dependent, so an unpinned linter is not a gate.
#
# The enable list is the backend's minus the linters whose finding classes this module does not
# have yet, plus the SQL ones, which it does. Exclusions are written out rather than taken from a
# preset: a preset also silences things we want to hear about.
version: "2"
linters:
default: none
enable:
- errcheck
- govet
- ineffassign
- staticcheck
- unused
# zero-cost bug classes for an HTTP + Postgres service
- bodyclose
- copyloopvar
- durationcheck
- errorlint
- makezero
- misspell
- nilerr
- noctx # a request without a context is a request that cannot be cancelled
- rowserrcheck
- sqlclosecheck
- nolintlint # no silent suppressions
settings:
staticcheck:
checks:
- all
- -ST1000 # default-off in golangci-lint: package comment form
- -ST1003 # default-off: naming conventions
- -ST1016 # default-off: receiver name consistency
- -ST1020 # default-off: comment form on exported methods
- -ST1021 # default-off: comment form on exported types
- -ST1022 # default-off: comment form on exported vars
nolintlint:
require-explanation: true
require-specific: true
allow-unused: false
exclusions:
rules:
# Close on a reader or a pool handle: nothing actionable comes back. This module has no
# flush-on-Close writer, so it cannot hide a lost write.
- linters: [errcheck]
text: 'Error return value of `[^`]*\.Close` is not checked'
# noctx exists to catch an uncancellable OUTBOUND call. httptest.NewRequest builds a request
# that is served in-process and never leaves it, so the rule fires 11 times and means nothing
# here; production code stays covered.
- linters: [noctx]
path: _test\.go
text: 'httptest\.NewRequest must not be called'
formatters:
enable:
- gofmt
issues:
max-issues-per-linter: 0 # never truncate: a hidden tail reads as "clean"
max-same-issues: 0