Files
go-lint/.golangci.yaml

135 lines
3.3 KiB
YAML

version: "2"
linters:
default: none
enable:
# Defaults
- errcheck
- govet
- ineffassign
- staticcheck
- unused
# Extras
- depguard
- errorlint
- err113
- forbidigo
- godox
- lll
- modernize
- nolintlint
- sqlclosecheck
- testpackage
- unqueryvet
- whitespace
- wrapcheck
# Custom linters
- ifinit
- boolnames
- httpstatus
settings:
custom:
ifinit:
type: module
description: if-statement init clauses must be on a single line
boolnames:
type: module
description: boolean variables and functions should use "is", "has", "was" etc
httpstatus:
type: module
description: HTTP status codes should use the project's typical-code policy
forbidigo:
forbid:
- pattern: ^sync\.Map$
msg: sync.Map loses type safety — use MutexMap instead
analyze-types: true
depguard:
rules:
main:
files:
- $all
deny:
- pkg: io/ioutil
desc: Replace with the matching functions from `io` or `os` packages
- pkg: github.com/pkg/errors
desc: Should be replaced by standard lib errors package
errcheck:
# report about not checking of errors in type assertions: `a := b.(MyStruct)`;
# default is false: such cases aren't reported by default.
check-type-assertions: true
errorlint:
errorf: true # Ensure Errorf only uses %w (not %v or %s etc) for errors
asserts: true # Require errors.As instead of type-asserting
comparison: true # Require errors.Is instead of equality-checking
godox:
# report any comments starting with keywords, this is useful for TODO or FIXME comments that
# might be left in the code accidentally and should be resolved before merging
keywords: # default keywords are TODO, BUG, and FIXME, these can be overwritten by this setting
- XXX
govet:
enable-all: true
disable:
- fieldalignment
lll:
line-length: 140
tab-width: 4
nolintlint:
require-explanation: true
require-specific: true
allow-unused: false
staticcheck:
checks:
- all
- -ST1000 # Re-enable this once we have docstrings
dot-import-whitelist: []
wrapcheck:
report-internal-errors: false
extra-ignore-sigs:
- "json.Marshal("
exclusions:
rules:
- path: _test.go
linters:
- errcheck
# Vendored from github.com/aldy505/sentry-integration/sqltracer — track
# upstream style, don't wrap errors (would break errors.Is/As across the
# transparent driver wrapper).
- path: pkg/db/sentrysql/
linters:
- wrapcheck
generated: lax # Don't lint generated files
paths: []
formatters:
enable:
- gci
- gofmt
- gofumpt
settings:
gci:
sections:
- standard
- default
- localmodule
gofmt:
simplify: true
gofumpt:
module-path: git.offline-twitter.com/offline-labs/go-lint
extra-rules: false
exclusions:
generated: lax
run:
build-tags:
- integration
- liveKeycloak
- staging
issues:
max-same-issues: 0
max-issues-per-linter: 0
uniq-by-line: false