celestiaorg / celestia-app

PoS application for the consensus portion of the Celestia network. Built using celestia-core (fork of CometBFT) and the cosmos-sdk
https://celestia.org
Apache License 2.0
330 stars 271 forks source link

Consider enabling `duplicated-imports` for revive #2155

Closed rootulp closed 1 year ago

rootulp commented 1 year ago

Context

Revive doesn't catch duplicate imports by default

Problem

If a dependency is imported twice with different names, revive won't warn you

tmtypes "github.com/cometbft/cometbft/types"
cmtypes "github.com/cometbft/cometbft/types"

Proposal

linters-settings:
  revive:
    rules:
      - name: duplicated-imports
        severity: warning
rootulp commented 1 year ago

Marking this as won't do b/c this repo already enabled stylecheck in https://github.com/celestiaorg/celestia-app/pull/2005 so if duplicated-imports is enabled for revive, two linters will complain for the same issue:

$ make lint
--> Running golangci-lint
pkg/shares/split_sparse_shares_test.go:9:2: duplicated-imports: Package "github.com/celestiaorg/celestia-app/pkg/namespace" already imported (revive)
    appns "github.com/celestiaorg/celestia-app/pkg/namespace"
    ^
pkg/shares/split_sparse_shares_test.go:8:2: ST1019: package "github.com/celestiaorg/celestia-app/pkg/namespace" is being imported more than once (stylecheck)
    app_ns "github.com/celestiaorg/celestia-app/pkg/namespace"
    ^
make: *** [lint] Error 1