golangci: enable new linters

Only newly added code will trigger these linter checks.
This commit is contained in:
yyforyongyu 2022-10-20 16:48:40 +08:00
parent 4db6617d45
commit 2fa2f24700
No known key found for this signature in database
GPG Key ID: 9BCD95C4FF296868

View File

@ -53,6 +53,16 @@ linters-settings:
# Tab width in spaces.
tab-width: 8
funlen:
# Checks the number of lines in a function.
# If lower than 0, disable the check.
# Default: 60
lines: 60
# Checks the number of statements in a function.
# Default: 40
statements: 40
linters:
enable-all: true
disable:
@ -65,18 +75,6 @@ linters:
# We want to allow TODOs.
- godox
# We have long functions, especially in tests. Moving or renaming those would
# trigger funlen problems that we may not want to solve at that time.
- funlen
# Disable for now as we haven't yet tuned the sensitivity to our codebase
# yet. Enabling by default for example, would also force new contributors to
# potentially extensively refactor code, when they want to smaller change to
# land.
- gocyclo
- gocognit
- cyclop
# Instances of table driven tests that don't pre-allocate shouldn't trigger
# the linter.
- prealloc
@ -84,46 +82,23 @@ linters:
# Init functions are used by loggers throughout the codebase.
- gochecknoinits
# Causes stack overflow, see https://github.com/polyfloyd/go-errorlint/issues/19.
- errorlint
# Deprecated linters. See https://golangci-lint.run/usage/linters/.
- interfacer
- golint
- maligned
- scopelint
# New linters that need a code adjustment first.
- wrapcheck
- nolintlint
- paralleltest
- tparallel
- testpackage
- gofumpt
- gomoddirectives
- ireturn
- maintidx
- nlreturn
- dogsled
- gci
- containedctx
- contextcheck
- errname
- exhaustivestruct
- exhaustruct
- goerr113
- gomnd
- ifshort
- noctx
- nestif
- wsl
- exhaustive
- forcetypeassert
- bodyclose
- contextcheck
- nilerr
- nilnil
- stylecheck
- thelper
- noctx
- rowserrcheck
- sqlclosecheck
- structcheck
- tparallel
- unparam
- wastedassign
issues:
# Only show newly introduced problems.
new-from-rev: 8c66353e4c02329abdacb5a8df29998035ec2e24
@ -134,9 +109,11 @@ issues:
- path: _test\.go
linters:
- gosec
- funlen
- path: test*
linters:
- gosec
- funlen
# Allow duplicated code and fmt.Printf() in DB migrations.
- path: channeldb/migration*
@ -172,3 +149,5 @@ issues:
- deadcode
- unparam
- govet
# itest case can be very long so we disable long function check.
- funlen