golangci: enable new linters

Only newly added code will trigger these linter checks.
This commit is contained in:
yyforyongyu committed 2022-10-20 23:59:10 +08:00
1 parent 4db6617d45
commit 2fa2f24700
1 file changed
+24 -45
+24 -45
View File
@@ -53,6 +53,16 @@ linters-settings:
# Tab width in spaces. # Tab width in spaces.
tab-width: 8 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: linters:
enable-all: true enable-all: true
disable: disable:
@@ -65,18 +75,6 @@ linters:
# We want to allow TODOs. # We want to allow TODOs.
- godox - 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 # Instances of table driven tests that don't pre-allocate shouldn't trigger
# the linter. # the linter.
- prealloc - prealloc
@@ -84,46 +82,23 @@ linters:
# Init functions are used by loggers throughout the codebase. # Init functions are used by loggers throughout the codebase.
- gochecknoinits - gochecknoinits
# Causes stack overflow, see https://github.com/polyfloyd/go-errorlint/issues/19.
- errorlint
# Deprecated linters. See https://golangci-lint.run/usage/linters/. # Deprecated linters. See https://golangci-lint.run/usage/linters/.
- interfacer - interfacer
- golint - golint
- maligned - maligned
- scopelint - 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 - exhaustivestruct
- exhaustruct - bodyclose
- goerr113 - contextcheck
- gomnd
- ifshort
- noctx
- nestif
- wsl
- exhaustive
- forcetypeassert
- nilerr - nilerr
- nilnil - noctx
- stylecheck - rowserrcheck
- thelper - sqlclosecheck
- structcheck
- tparallel
- unparam
- wastedassign
issues: issues:
# Only show newly introduced problems. # Only show newly introduced problems.
new-from-rev: 8c66353e4c02329abdacb5a8df29998035ec2e24 new-from-rev: 8c66353e4c02329abdacb5a8df29998035ec2e24
@@ -134,9 +109,11 @@ issues:
- path: _test\.go - path: _test\.go
linters: linters:
- gosec - gosec
- funlen
- path: test* - path: test*
linters: linters:
- gosec - gosec
- funlen
# Allow duplicated code and fmt.Printf() in DB migrations. # Allow duplicated code and fmt.Printf() in DB migrations.
- path: channeldb/migration* - path: channeldb/migration*
@@ -172,3 +149,5 @@ issues:
- deadcode - deadcode
- unparam - unparam
- govet - govet
# itest case can be very long so we disable long function check.
- funlen