update linter and it's rules

This commit is contained in:
Ruslan Efanov 2022-12-30 10:42:29 +03:00
parent 21e9551b32
commit 56bf4df310
2 changed files with 37 additions and 23 deletions

View File

@ -31,7 +31,7 @@ jobs:
- name: Lint code with golangci-lint - name: Lint code with golangci-lint
uses: golangci/golangci-lint-action@v3 uses: golangci/golangci-lint-action@v3
with: with:
version: v1.36 version: v1.50.1
only-new-issues: true only-new-issues: true
tests: tests:
name: Tests name: Tests

View File

@ -6,20 +6,33 @@ output:
format: colored-line-number format: colored-line-number
sort-results: true 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: linters:
disable-all: true disable-all: true
enable: enable:
- deadcode - paralleltest
- tparallel
- asciicheck
- asasalint
- varnamelen
- reassign
- nilnil
- nilerr
- nakedret
- goprintffuncname
- typecheck
- errchkjson
- errcheck - errcheck
- gosimple - gosimple
- govet - govet
- ineffassign - ineffassign
- staticcheck - staticcheck
- structcheck
- unused - unused
- unparam - unparam
- varcheck
- bodyclose
- dogsled - dogsled
- dupl - dupl
- errorlint - errorlint
@ -32,20 +45,15 @@ linters:
- gocyclo - gocyclo
- godot - godot
- goimports - goimports
- golint - revive
- gomnd
- gosec - gosec
- ifshort
- interfacer
- lll - lll
- makezero - makezero
- maligned
- misspell - misspell
- nestif - nestif
- prealloc - prealloc
- predeclared - predeclared
- scopelint - exportloopref
- sqlclosecheck
- unconvert - unconvert
- whitespace - whitespace
@ -56,9 +64,11 @@ linters-settings:
enable: enable:
- assign - assign
- atomic - atomic
- atomicalign
- bools - bools
- buildtag - buildtag
- copylocks - copylocks
- fieldalignment
- httpresponse - httpresponse
- loopclosure - loopclosure
- lostcancel - lostcancel
@ -70,7 +80,6 @@ linters-settings:
- unmarshal - unmarshal
- unreachable - unreachable
- unsafeptr - unsafeptr
- unused
settings: settings:
printf: printf:
funcs: funcs:
@ -129,11 +138,13 @@ linters-settings:
threshold: 200 threshold: 200
errorlint: errorlint:
errorf: true errorf: true
asserts: false
comparison: false
exhaustive: exhaustive:
check-generated: false check-generated: false
default-signifies-exhaustive: false default-signifies-exhaustive: false
funlen: funlen:
lines: 60 lines: 90
statements: 40 statements: 40
gocognit: gocognit:
min-complexity: 25 min-complexity: 25
@ -143,8 +154,6 @@ linters-settings:
local-prefixes: github.com/retailcrm/mg-bot-api-client-go local-prefixes: github.com/retailcrm/mg-bot-api-client-go
lll: lll:
line-length: 120 line-length: 120
maligned:
suggest-new: true
misspell: misspell:
locale: US locale: US
nestif: nestif:
@ -152,22 +161,25 @@ linters-settings:
whitespace: whitespace:
multi-if: false multi-if: false
multi-func: 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: issues:
exclude-rules: exclude-rules:
- path: _test\.go - path: _test\.go
linters: linters:
- gomnd
- lll - lll
- bodyclose
- errcheck - errcheck
- sqlclosecheck
- misspell - misspell
- ineffassign - ineffassign
- whitespace - whitespace
- makezero - makezero
- maligned
- ifshort
- errcheck - errcheck
- funlen - funlen
- goconst - goconst
@ -175,6 +187,8 @@ issues:
- gocyclo - gocyclo
- godot - godot
- unused - unused
- errchkjson
- varnamelen
exclude-use-default: true exclude-use-default: true
exclude-case-sensitive: false exclude-case-sensitive: false
max-issues-per-linter: 0 max-issues-per-linter: 0
@ -186,4 +200,4 @@ severity:
case-sensitive: false case-sensitive: false
service: service:
golangci-lint-version: 1.36.x golangci-lint-version: 1.50.x