From bfa6bdcac828673c3343f298358a7e7bfd39444a Mon Sep 17 00:00:00 2001 From: Leonid Date: Tue, 20 May 2025 15:41:48 +0300 Subject: [PATCH] chore: upd lint rules for V2 lint --- .golangci.v1.yml | 137 +++++++++++++++++++++++++++++++++++++++++ .golangci.yml | 154 +++++++++++++++++++++++++---------------------- 2 files changed, 220 insertions(+), 71 deletions(-) create mode 100644 .golangci.v1.yml diff --git a/.golangci.v1.yml b/.golangci.v1.yml new file mode 100644 index 0000000..d04d996 --- /dev/null +++ b/.golangci.v1.yml @@ -0,0 +1,137 @@ +run: + timeout: 5m + +# The list of linter based on the v1.64.5 +# See the full list https://golangci-lint.run/usage/linters/ +linters: + disable-all: true + enable: + - errcheck + - gosimple + - govet + - ineffassign + - staticcheck + - unused + - asasalint + - asciicheck + - bidichk + - bodyclose + - containedctx + - contextcheck + - cyclop + - dogsled + - dupl + - dupword + - durationcheck + - err113 + - errchkjson + - errname + - errorlint + - exptostd + - forbidigo + - forcetypeassert + - funlen + - gochecknoinits + - gocognit + - goconst + - gocritic + - gocyclo + - gofmt + - goimports + - goprintffuncname + - gosec + - grouper + - iface + - importas + - ireturn + - lll + - loggercheck + - maintidx + - makezero + - mirror + - misspell + - mnd + - musttag + - nakedret + - nestif + - nilerr + - nilnesserr + - nilnil + - nlreturn + - noctx + - nolintlint + - perfsprint + - prealloc + - predeclared + - protogetter + - reassign + - recvcheck + - revive + - rowserrcheck + - sloglint + - sqlclosecheck + - stylecheck + - tagliatelle + - testifylint + - unconvert + - unparam + - usestdlibvars + - usetesting + - wastedassign + - whitespace + +linters-settings: + goimports: + local-prefixes: github.com/example/repo + dupl: + threshold: 150 + funlen: + lines: 120 + statements: 60 + goconst: + min-len: 2 + min-occurrences: 2 + gocritic: + enabled-tags: + - diagnostic + - experimental + - opinionated + - performance + - style + gocyclo: + min-complexity: 20 + cyclop: + max-complexity: 20 + skip-tests: true + lll: + line-length: 140 + misspell: + locale: US + nolintlint: + allow-unused: false + require-explanation: false + require-specific: false + nestif: + min-complexity: 4 + +issues: + #new-from-rev: HEAD + exclude-dirs: + - tilt_modules + - vendor + exclude-rules: + - path: _test\.go + linters: + - dupl + - mnd + - funlen + - gocyclo + - lll + - err113 + - maintidx + - ireturn + - path: main\.go + linters: + - funlen + - forbidigo + - cyclop diff --git a/.golangci.yml b/.golangci.yml index d04d996..2b12a5b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,17 +1,11 @@ -run: - timeout: 5m - -# The list of linter based on the v1.64.5 -# See the full list https://golangci-lint.run/usage/linters/ +version: "2" +issues: + #new-from-rev: HEAD linters: - disable-all: true + default: none + # The list of linter based on the v2.1.6 + # See the full list https://golangci-lint.run/usage/linters/ enable: - - errcheck - - gosimple - - govet - - ineffassign - - staticcheck - - unused - asasalint - asciicheck - bidichk @@ -24,6 +18,7 @@ linters: - dupword - durationcheck - err113 + - errcheck - errchkjson - errname - errorlint @@ -36,13 +31,13 @@ linters: - goconst - gocritic - gocyclo - - gofmt - - goimports - goprintffuncname - gosec + - govet - grouper - iface - importas + - ineffassign - ireturn - lll - loggercheck @@ -70,68 +65,85 @@ linters: - rowserrcheck - sloglint - sqlclosecheck - - stylecheck + - staticcheck - tagliatelle - testifylint - unconvert - unparam + - unused - usestdlibvars - usetesting - wastedassign - whitespace - -linters-settings: - goimports: - local-prefixes: github.com/example/repo - dupl: - threshold: 150 - funlen: - lines: 120 - statements: 60 - goconst: - min-len: 2 - min-occurrences: 2 - gocritic: - enabled-tags: - - diagnostic - - experimental - - opinionated - - performance - - style - gocyclo: - min-complexity: 20 - cyclop: - max-complexity: 20 - skip-tests: true - lll: - line-length: 140 - misspell: - locale: US - nolintlint: - allow-unused: false - require-explanation: false - require-specific: false - nestif: - min-complexity: 4 - -issues: - #new-from-rev: HEAD - exclude-dirs: - - tilt_modules - - vendor - exclude-rules: - - path: _test\.go - linters: - - dupl - - mnd - - funlen - - gocyclo - - lll - - err113 - - maintidx - - ireturn - - path: main\.go - linters: - - funlen - - forbidigo - - cyclop + settings: + cyclop: + max-complexity: 20 + dupl: + threshold: 150 + funlen: + lines: 120 + statements: 60 + goconst: + min-len: 2 + min-occurrences: 2 + gocritic: + enabled-tags: + - diagnostic + - experimental + - opinionated + - performance + - style + gocyclo: + min-complexity: 20 + lll: + line-length: 140 + misspell: + locale: US + nestif: + min-complexity: 4 + nolintlint: + require-explanation: false + require-specific: false + allow-unused: false + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + rules: + - linters: + - dupl + - err113 + - funlen + - gocyclo + - ireturn + - lll + - maintidx + - mnd + path: _test\.go + - linters: + - cyclop + - forbidigo + - funlen + path: main\.go + - linters: + - cyclop + path: (.+)_test\.go + paths: + - tilt_modules + - vendor +formatters: + enable: + - gofmt + - goimports + settings: + goimports: + local-prefixes: + - github.com/example/repo + exclusions: + generated: lax + paths: + - tilt_modules + - vendor