diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index ab9ff71..5bed339 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -28,7 +28,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: lint - uses: golangci/golangci-lint-action@v6.5.2 + uses: golangci/golangci-lint-action@v7.0.0 with: version: latest diff --git a/.golangci.yml b/.golangci.yml index 0e77937..6dca4b8 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,90 +1,101 @@ -linters-settings: - gocyclo: - min-complexity: 15 - dupl: - threshold: 100 - goconst: - min-len: 2 - min-occurrences: 3 - misspell: - locale: US - lll: - line-length: 140 - goimports: - local-prefixes: github.com/gotd/tl - gocritic: - enabled-tags: - - diagnostic - - experimental - - opinionated - - performance - - style - disabled-checks: - - hugeParam - - rangeValCopy - - exitAfterDefer - - whyNoLint - - singleCaseSwitch - +version: "2" linters: - disable-all: true + default: none enable: - dogsled - dupl - errcheck + - gochecknoglobals - gochecknoinits + - gocognit - goconst - gocritic - gocyclo - - gofmt - - goimports - gosec - - gosimple - govet - ineffassign - lll - misspell - nakedret - staticcheck - - stylecheck - - typecheck - unconvert - unparam - unused - whitespace - - gochecknoglobals - - gocognit - - # Do not enable: - # - wsl (too opinionated about newlines) - # - godox (todos are OK) - # - bodyclose (false positives on helper functions) - # - prealloc (not worth it in scope of this project) - # - maligned (same as prealloc) - # - funlen (gocyclo is enough) - -issues: - exclude-rules: - # TODO(ernado): Should we refactor Parse() functions? - - linters: [gocyclo, gocognit] - text: "Parse" - - # Disable linters that are annoying in tests. - - path: _test\.go - linters: - - gocyclo - - errcheck - - dupl - - gosec - - funlen - - goconst - - gocognit - - scopelint - - lll - - gochecknoglobals - # Ignore shadowing of err. - - linters: [govet] - text: 'declaration of "err"' - # Ignore linters in main packages. - - path: main\.go - linters: [gochecknoglobals, goconst, funlen, gocognit, gocyclo] + settings: + dupl: + threshold: 100 + goconst: + min-len: 2 + min-occurrences: 3 + gocritic: + disabled-checks: + - hugeParam + - rangeValCopy + - exitAfterDefer + - whyNoLint + - singleCaseSwitch + enabled-tags: + - diagnostic + - experimental + - opinionated + - performance + - style + gocyclo: + min-complexity: 15 + lll: + line-length: 140 + misspell: + locale: US + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + rules: + - linters: + - gocognit + - gocyclo + text: Parse + - linters: + - dupl + - errcheck + - funlen + - gochecknoglobals + - gocognit + - goconst + - gocyclo + - gosec + - lll + - scopelint + path: _test\.go + - linters: + - govet + text: declaration of "err" + - linters: + - funlen + - gochecknoglobals + - gocognit + - goconst + - gocyclo + path: main\.go + paths: + - third_party$ + - builtin$ + - examples$ +formatters: + enable: + - gofmt + - goimports + settings: + goimports: + local-prefixes: + - github.com/gotd/tl + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$