Files

174 lines
4.1 KiB
YAML

version: "2"
run:
timeout: 5m
tests: true
linters:
default: standard
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- contextcheck
- copyloopvar
- depguard
- durationcheck
- embeddedstructfieldcheck
- errname
- errorlint
- exhaustive
- exptostd
- fatcontext
- forbidigo
- gocheckcompilerdirectives
- gochecknoinits
- gochecksumtype
- gocritic
- gocyclo
- gosec
- goprintffuncname
- inamedparam
- iotamixing
- loggercheck
- makezero
- mirror
- misspell
- musttag
- nakedret
- nilerr
- nilnesserr
- noctx
- nolintlint
- prealloc
- predeclared
- reassign
- revive
- rowserrcheck
- sloglint
- sqlclosecheck
- tagalign
- testableexamples
- testifylint
- thelper
- unconvert
- unparam
- unqueryvet
- wastedassign
- whitespace
- zerologlint
settings:
depguard:
rules:
# The local Resend stand-in exists for tests of the delivery layer
# only; no production package may import it.
resend-fixture-tests-only:
list-mode: lax
files:
- "!$test"
# This command is compiled only by the local E2E mail image.
- "!**/cmd/mail-fixture/main.go"
deny:
- pkg: lincodex/backend/internal/adapter/secondary/mail/resend/resendfixture
desc: the Resend fixture is for tests only
forbidigo:
forbid:
# It accepts a loopback endpoint instead of the fixed Resend one, so
# only tests may call it (see the exclusion for test files below).
- pattern: ^resend\.NewLoopbackSender$
msg: resend.NewLoopbackSender is for tests only; production uses resend.NewSender
gocyclo:
min-complexity: 15
govet:
enable-all: true
disable:
- fieldalignment
- shadow
revive:
rules:
- name: blank-imports
- name: context-as-argument
- name: context-keys-type
- name: error-return
- name: error-strings
- name: error-naming
- name: var-declaration
- name: range
- name: receiver-naming
- name: time-naming
- name: indent-error-flow
- name: errorf
- name: empty-block
- name: superfluous-else
- name: unused-parameter
- name: unreachable-code
- name: redefines-builtin-id
nolintlint:
allow-unused: false
require-explanation: true
require-specific: true
gosec:
excludes:
- G104
staticcheck:
checks:
- all
testifylint:
enable-all: true
disable:
- go-require
exclusions:
generated: strict
paths:
- internal/adapter/primary/http/api/
- internal/adapter/secondary/ml/api/
- internal/adapter/secondary/code_runner/api/
- internal/adapter/secondary/lab_provisioner/api/
- internal/adapter/secondary/postgres/sqlc/
- internal/bootstrap/wire_gen\.go$
- (^|/)mocks/
presets:
- comments
- common-false-positives
rules:
# Error locations use actual Go identifiers, including exported type names.
- linters:
- staticcheck
text: 'ST1005: error strings should not be capitalized'
source: '(fmt\.Errorf|errors\.New)\("[A-Z][A-Za-z0-9]*\.[A-Za-z0-9]+ - '
- path: _test\.go
linters:
- gocyclo
- gosec
- errcheck
- dupl
- path: _test\.go
linters:
- forbidigo
- path: _test\.go
text: net/http/httptest\.NewRequest must not be called
linters:
- noctx
formatters:
enable:
- gofmt
- goimports
exclusions:
generated: strict
paths:
- internal/adapter/primary/http/api/
- internal/adapter/secondary/ml/api/
- internal/adapter/secondary/code_runner/api/
- internal/adapter/secondary/lab_provisioner/api/
- internal/adapter/secondary/postgres/sqlc/
- internal/bootstrap/wire_gen\.go$
- (^|/)mocks/
issues:
max-issues-per-linter: 0
max-same-issues: 0