Files
gocryptotrader/.golangci.yml
Gareth Kirwan 5d6755b76e linters: Exclude govet shadow check on exchange instances (#2097)
* Linters: Exclude govet shadow check on e in tests

* Linters: Remove nolint rule for new(Exchange) in tests

Replay with:
```
perl -pi -e 's{(\se\s:=\s.*?)\s*//nolint:govet // Intentional shadow.*}{$1}' **/*_test.go
```
2025-10-29 09:30:23 +11:00

215 lines
4.2 KiB
YAML

version: "2"
run:
issues-exit-code: 1
tests: true
linters:
default: none
enable:
# defaults
- errcheck
- govet
- ineffassign
- staticcheck
- unused
# disabled by default linters
# - arangolint
# - asasalint
- asciicheck
- bidichk
- bodyclose
# - canonicalheader
- containedctx
# - contextcheck
- copyloopvar
# - cyclop
- decorder
- depguard
- dogsled
# - dupl
- dupword
- durationcheck
# - embeddedstructfieldcheck
# - err113
- errchkjson
- errname
# - errorlint
# - exhaustive
# - exhaustruct
# - exptostd
- fatcontext
# - forbidigo
- forcetypeassert
# - funcorder
# - funlen
# - ginkgolinter
- gocheckcompilerdirectives
# - gochecknoglobals
# - gochecknoinits
- gochecksumtype
# - gocognit
- goconst
- gocritic
# - gocyclo
# - godot
# - godox
# - goheader
- gomoddirectives
- gomodguard
- goprintffuncname
- gosec
# - gosmopolitan
- grouper
- iface
# - importas
# - inamedparam
# - interfacebloat
- intrange
# - ireturn
# - lll
# - loggercheck
# - maintidx
- makezero
- mirror
- misspell
# - mnd
# - musttag
# - nakedret
# - nestif
- nilerr
- nilnesserr
# - nilnil
# - nlreturn
- noctx
# - noinlineerr
- nolintlint
# - nonamedreturns
- nosprintfhostport
# - paralleltest
- perfsprint
- prealloc
- predeclared
# - promlinter
# - protogetter
- reassign
# - recvcheck
- revive
- rowserrcheck
# - sloglint
# - spancheck
- sqlclosecheck
- tagalign
# - tagliatelle
- testableexamples
- testifylint
# - testpackage
- thelper
- tparallel
- unconvert
- unparam
- usestdlibvars
- usetesting
# - varnamelen
- wastedassign
- whitespace
# - wrapcheck
# - wsl_v5
# - zerologlint
# - wsl // Deprecated
settings:
depguard:
rules:
prevent_json_package_use:
list-mode: lax
files:
- $all
allow:
- github.com/thrasher-corp/gocryptotrader/encoding/json
deny:
- pkg: encoding/json
desc: Please use the custom JSON package github.com/thrasher-corp/gocryptotrader/encoding/json instead of encoding/json to allow sonic/json switching.
goconst:
min-occurrences: 6
gocritic:
disabled-checks:
- wrapperFunc
- methodExprCall
- evalOrder
enabled-tags:
- performance
- style
- experimental
govet:
enable:
- shadow
- nilness
- unusedwrite
staticcheck:
checks:
- all
- '-ST1000' # Disable at least one file in a package should have a package comment check
- '-QF1005' # Disable expand call to math.Pow check
- '-QF1008' # Disable embedded field from selector check
testifylint:
enable-all: true
disable:
- require-error
- float-compare
# We deliberately use Equal over Len to avoid spamming the contents of large Slices
- len
exclusions:
generated: lax
presets:
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- gosec
text: Expect WriteFile permissions to be 0600 or less
- linters:
- govet
text: 'shadow: declaration of "err" shadows declaration at'
- linters:
- govet
path: _test\.go
text: 'shadow: declaration of "e" shadows declaration at'
- linters:
- revive
text: 'should have a package comment'
- linters:
- revive
text: "var-naming: avoid meaningless package names"
paths:
- vendor
- web/
- testdata
- database/models/
- third_party$
- builtin$
- examples$
issues:
max-issues-per-linter: 0
max-same-issues: 0
formatters:
enable:
- gci
- gofmt
- gofumpt
- goimports
settings:
gofumpt:
extra-rules: true
exclusions:
generated: lax
paths:
- vendor
- web/
- testdata
- database/models/
- third_party$
- builtin$
- examples$