Skip to content

Instantly share code, notes, and snippets.

@devdrops
Created September 12, 2024 01:06
Show Gist options
  • Save devdrops/f7fce2e35f6804a355df821da2d253b5 to your computer and use it in GitHub Desktop.
Save devdrops/f7fce2e35f6804a355df821da2d253b5 to your computer and use it in GitHub Desktop.
golangci-lint settings
run:
concurrency: 4
timeout: 5m
issues-exit-code: 1
tests: true
allow-parallel-runners: true
allow-serial-runners: true
go: '1.23.1'
output:
formats:
- format: colored-line-number
print-issued-lines: true
print-linter-name: true
uniq-by-line: true
path-prefix: ""
sort-results: true
sort-order:
- linter
- severity
- file
show-stats: true
linters:
presets:
- bugs
- comment
- complexity
- error
- format
- import
- metalinter
- module
- performance
- sql
- style
- test
- unused
fast: true
enable:
- bodyclose
- contextcheck
- gocheckcompilerdirectives
- errname
- gochecknoinits
- nilerr
- noctx
- tparallel
- wastedassign
- sqlclosecheck
- depguard
- errcheck
- gosimple
- govet
- staticcheck
- unused
- copyloopvar
- cyclop
- decorder
- dogsled
- dupl
- errorlint
- funlen
- gci
- goconst
- gocritic
- godox
- gosec
- interfacebloat
- lll
- misspell
- nestif
- perfsprint
- prealloc
- usestdlibvars
- unparam
- wsl
- tagliatelle
linters-settings:
depguard:
rules:
main:
list-mode: original
files:
- "!**/*.go"
allow:
- $gostd
- bitbucket.org/asappay/go-transaction-vault-ms/infra/config
- bitbucket.org/asappay/go-transaction-vault-ms/infra/handler
- bitbucket.org/asappay/go-transaction-vault-ms/infra/health
- bitbucket.org/asappay/go-transaction-vault-ms/infra/logger
- bitbucket.org/asappay/go-transaction-vault-ms/infra/middleware
- bitbucket.org/asappay/go-transaction-vault-ms/infra/tools
- bitbucket.org/asappay/go-transaction-vault-ms/internal/bankaccount
- bitbucket.org/asappay/go-transaction-vault-ms/internal/bankstatement
- bitbucket.org/asappay/go-transaction-vault-ms/internal/bankstatementline
- bitbucket.org/asappay/go-transaction-vault-ms/internal/p2p
- bitbucket.org/asappay/go-transaction-vault-ms/internal/paybill
- bitbucket.org/asappay/go-transaction-vault-ms/internal/pix
- bitbucket.org/asappay/go-transaction-vault-ms/internal/ted
- bitbucket.org/asapshared/go-multisqldb-pg
- github.com/go-chi/chi/v5
- github.com/go-chi/chi/v5/middleware
- go.uber.org/zap
errcheck:
check-type-assertions: true
check-blank: true
disable-default-exclusions: true
gosimple:
checks: ["all"]
govet:
enable:
- appends
- asmdecl
- assign
- atomic
- atomicalign
- bools
- buildtag
- cgocall
- composites
- copylocks
- deepequalerrors
- defers
- directive
- errorsas
- findcall
- framepointer
- httpresponse
- ifaceassert
- loopclosure
- lostcancel
- nilfunc
- nilness
- printf
- reflectvaluecompare
- shadow
- shift
- sigchanyzer
- slog
- sortslice
- stdmethods
- stringintconv
- structtag
- testinggoroutine
- tests
- unmarshal
- unreachable
- unsafeptr
- unusedresult
- unusedwrite
disable:
- fieldalignment
settings:
printf:
funcs:
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
shadow:
strict: true
unusedresult:
funcs:
- pkg.MyFunc
stringmethods:
- MyMethod
staticcheck:
checks: ["all"]
unused:
field-writes-are-uses: true
post-statements-are-reads: true
exported-fields-are-used: false
parameters-are-used: true
local-variables-are-used: false
generated-is-used: false
copyloopvar:
check-alias: true
cyclop:
max-complexity: 10
package-average: 5
skip-tests: true
decorder:
dec-order:
- type
- const
- var
- func
ignore-underscore-vars: false
disable-dec-order-check: false
disable-init-func-first-check: false
disable-dec-num-check: false
disable-type-dec-num-check: false
disable-const-dec-num-check: false
disable-var-dec-num-check: false
dogsled:
max-blank-identifiers: 1
dupl:
threshold: 150
errorlint:
errorf: true
errorf-multi: true
asserts: true
comparison: true
funlen:
lines: 150
statements: -1
ignore-comments: true
gci:
sections:
- standard
- default
- prefix(bitbucket.org/asappay/go-transaction-vault-ms)
- blank
- dot
- alias
- localmodule
skip-generated: true
custom-order: true
goconst:
min-len: 1
min-occurrences: 3
ignore-tests: true
match-constant: true
numbers: true
min: 2
max: 2
ignore-calls: false
gocritic:
disabled-checks:
- hugeParam
enabled-tags:
- diagnostic
- style
- performance
- experimental
- opinionated
settings:
captLocal:
paramsOnly: false
commentedOutCode:
minLength: 50
elseif:
skipBalanced: false
hugeParam:
sizeThreshold: 70
ifElseChain:
minThreshold: 4
nestingReduce:
bodyWidth: 4
rangeExprCopy:
sizeThreshold: 516
skipTestFuncs: false
rangeValCopy:
sizeThreshold: 32
skipTestFuncs: false
ruleguard:
debug: 'emptyDecl'
failOn: dsl,import
# rules: '${configDir}/gocritic-rules.go'
enable: "myGroupName,#myTagName"
disable: "myGroupName,#myTagName"
tooManyResultsChecker:
maxResults: 10
truncateCmp:
skipArchDependent: false
underef:
skipRecvDeref: false
unnamedResult:
checkExported: true
godox:
keywords:
- NOTE
- OPTIMIZE
- HACK
gosec:
includes:
- G101
- G102
- G103
- G104
- G106
- G107
- G108
- G109
- G110
- G111
- G112
- G113
- G114
- G115
- G201
- G202
- G203
- G204
- G301
- G302
- G303
- G304
- G305
- G306
- G307
- G401
- G402
- G403
- G404
- G405
- G406
- G501
- G502
- G503
- G504
- G505
- G506
- G507
- G601
- G602
exclude-generated: false
severity: low
confidence: low
concurrency: 4
config:
global:
nosec: false
show-ignored: true
audit: true
interfacebloat:
max: 5
lll:
line-length: 150
tab-width: 1
misspell:
locale: US
mode: default
nestif:
min-complexity: 3
perfsprint:
int-conversion: true
err-error: true
errorf: true
sprintf1: true
strconcat: true
prealloc:
simple: true
range-loops: true
for-loops: true
usestdlibvars:
http-method: true
http-status-code: true
time-weekday: true
time-month: true
time-layout: true
crypto-hash: true
default-rpc-path: true
sql-isolation-level: true
tls-signature-scheme: true
constant-kind: true
unparam:
check-exported: true
wsl:
strict-append: true
allow-assign-and-call: true
allow-assign-and-anything: true
allow-multiline-assign: true
force-case-trailing-whitespace: 0
allow-trailing-comment: true
allow-separated-leading-comment: true
allow-cuddle-declarations: true
force-err-cuddling: true
force-short-decl-cuddling: false
tagliatelle:
case:
use-field-name: false
rules:
json: snake
yaml: camel
env: upperSnake
envconfig: upperSnake
issues:
exclude-dirs:
- env
- spec
exclude-generated: strict
exclude-rules:
- path: (.+)_test.go
linters:
- funlen
- nestif
- lll
include:
- EXC0001
- EXC0002
- EXC0003
- EXC0004
- EXC0005
- EXC0006
- EXC0007
- EXC0008
- EXC0009
- EXC0010
- EXC0011
- EXC0012
- EXC0013
- EXC0014
- EXC0015
max-issues-per-linter: 50
max-same-issues: 3
new: false
whole-files: true
fix: true
severity:
default-severity: error
case-sensitive: true
rules:
- linters:
- dupl
severity: info

golangci-lint settings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment