Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: enable linting on go tests #3695

Closed
Tracked by #4620
faddat opened this issue Dec 12, 2022 · 1 comment
Closed
Tracked by #4620

chore: enable linting on go tests #3695

faddat opened this issue Dec 12, 2022 · 1 comment

Comments

@faddat
Copy link
Member

faddat commented Dec 12, 2022

So, when I was working on the ibc-go upgrade to v0.47.x, I noticed something:

run:
  tests: false
  timeout: 5m

linters:
  disable-all: true
  # Enable specific linter
  # https://golangci-lint.run/usage/linters/#enabled-by-default-linters
  enable:
    - asciicheck
    - bidichk
    - depguard
    - durationcheck
    - errcheck
    - errname
    - exportloopref
    - forcetypeassert
    - goconst
    - gofumpt
    - goheader
    - gomodguard
    - goprintffuncname
    - gosimple
    - govet
    - importas
    - ineffassign
    - makezero
    - misspell
    - nakedret
    - nilnil
    - paralleltest
    - promlinter
    - staticcheck
    - stylecheck
    - tenv
    - testpackage
    - typecheck
    - unconvert
    - unused
    - whitespace

issues:
  exclude-rules:
    - path: x/gamm/pool-models/stableswap
      linters:
        # Stableswap is in development.
        # We should re-enable deadcode and unused linting
        # across its files, once stableswap is fully complete.
        - unused
        - deadcode
    - linters:
        - staticcheck
      text: "SA1024: cutset contains duplicate characters" # proved to not provide much value, only false positives.
    - linters:
        - staticcheck
      text: "SA9004: only the first constant in this group has an explicit type" # explicitly recommended in go syntax
    - linters:
        - stylecheck
      text: "ST1003:" # requires identifiers with "id" to be "ID".
    - linters:
        - stylecheck
      text: "ST1005:" # punctuation in error messages
  max-issues-per-linter: 10000
  max-same-issues: 10000

See how tests are set to false? This meant that in the cosmos-sdk and ibc-go, tests weren't being linted.

So basically, I'm proposing that I make another PR like #3486 and that will change tests: false to tests:true.

Then we can change the Makefile, so that the only thing we do for both formatting and linting is:

golangci-run ./... --fix
@ValarDragon ValarDragon changed the title chore: formatting and linting chore: enable linting on go tests Jan 2, 2023
@ValarDragon
Copy link
Member

ValarDragon commented Jan 2, 2023

SGTM (though make lint should not run -fix)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

3 participants