update linter and it's rules

This commit is contained in:
Ruslan Efanov 2022-12-29 15:04:57 +03:00
parent 6c5eb72848
commit 49905ab9c6
2 changed files with 36 additions and 22 deletions

View File

@ -31,7 +31,7 @@ jobs:
- name: Lint code with golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.45.2
version: v1.50.1
only-new-issues: true
skip-pkg-cache: true
args: --build-tags=testutils

View File

@ -8,20 +8,33 @@ output:
format: colored-line-number
sort-results: true
# Linters below do not support go1.18 yet because of generics.
# See https://github.com/golangci/golangci-lint/issues/2649
# - bodyclose
# - sqlclosecheck
linters:
disable-all: true
enable:
- deadcode
- paralleltest
- tparallel
- asciicheck
- asasalint
- varnamelen
- reassign
- nilnil
- nilerr
- nakedret
- goprintffuncname
- typecheck
- errchkjson
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- structcheck
- unused
- unparam
- varcheck
- bodyclose
- dogsled
- dupl
- errorlint
@ -35,16 +48,14 @@ linters:
- godot
- goimports
- revive
- gomnd
- gosec
- ifshort
- lll
- makezero
- misspell
- nestif
- prealloc
- predeclared
- sqlclosecheck
- exportloopref
- unconvert
- whitespace
@ -55,6 +66,7 @@ linters-settings:
enable:
- assign
- atomic
- atomicalign
- bools
- buildtag
- copylocks
@ -69,7 +81,7 @@ linters-settings:
- unmarshal
- unreachable
- unsafeptr
- unused
- fieldalignment
settings:
printf:
funcs:
@ -137,11 +149,13 @@ linters-settings:
threshold: 200
errorlint:
errorf: true
asserts: false
comparison: false
exhaustive:
check-generated: false
default-signifies-exhaustive: false
funlen:
lines: 60
lines: 90
statements: 40
gocognit:
min-complexity: 25
@ -151,8 +165,6 @@ linters-settings:
local-prefixes: github.com/retailcrm/api-client-go/v2
lll:
line-length: 160
maligned:
suggest-new: true
misspell:
locale: US
nestif:
@ -160,32 +172,34 @@ linters-settings:
whitespace:
multi-if: false
multi-func: false
varnamelen:
max-distance: 10
ignore-map-index-ok: true
ignore-type-assert-ok: true
ignore-chan-recv-ok: true
ignore-decls:
- t *testing.T
- e error
- i int
issues:
exclude-rules:
- path: _test\.go
linters:
- gomnd
- lll
- bodyclose
- errcheck
- sqlclosecheck
- misspell
- ineffassign
- whitespace
- makezero
- maligned
- ifshort
- errcheck
- funlen
- goconst
- gocognit
- gocyclo
- godot
- gocritic
- gosec
- staticcheck
- unused
- errchkjson
- varnamelen
exclude-use-default: true
exclude-case-sensitive: false
max-issues-per-linter: 0
@ -197,4 +211,4 @@ severity:
case-sensitive: false
service:
golangci-lint-version: 1.36.x
golangci-lint-version: 1.50.x