Skip to content

Commit

Permalink
refactor: use gci linter to sort imports (#2608)
Browse files Browse the repository at this point in the history
* use the gci linter to sort imports

* enable custom ordering in gci
  • Loading branch information
faddat authored Jul 18, 2023
1 parent a759409 commit 69d1dd0
Show file tree
Hide file tree
Showing 49 changed files with 230 additions and 171 deletions.
15 changes: 14 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ linters:
- dogsled
- errcheck
- exportloopref
- gci
- goconst
- gocritic
- gofumpt
Expand Down Expand Up @@ -57,6 +58,18 @@ issues:
max-same-issues: 10000

linters-settings:
gci:
custom-order: true
sections:
- standard # Standard section: captures all standard packages.
- default # Default section: contains all imports that could not be matched to another section type.
- blank # blank imports
- dot # dot imports
- prefix(github.com/cometbft/cometbft) # comet
- prefix(github.com/cosmos) # cosmos org
- prefix(cosmossdk.io) # new modules
- prefix(github.com/cosmos/cosmos-sdk) # cosmos sdk
- prefix(github.com/cosmos/gaia) # Gaia
dogsled:
max-blank-identifiers: 3
maligned:
Expand Down Expand Up @@ -94,4 +107,4 @@ linters-settings:
- name: empty-block
- name: superfluous-else
- name: unreachable-code
- name: redefines-builtin-id
- name: redefines-builtin-id
8 changes: 5 additions & 3 deletions ante/ante.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
package ante

import (
ibcante "github.com/cosmos/ibc-go/v4/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper"

errorsmod "cosmossdk.io/errors"

"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
gaiaerrors "github.com/cosmos/gaia/v11/types/errors"
ibcante "github.com/cosmos/ibc-go/v4/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper"

gaiaerrors "github.com/cosmos/gaia/v11/types/errors"
gaiafeeante "github.com/cosmos/gaia/v11/x/globalfee/ante"
)

Expand Down
5 changes: 3 additions & 2 deletions ante/gov_ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package ante

import (
errorsmod "cosmossdk.io/errors"

"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
gaiaerrors "github.com/cosmos/gaia/v11/types/errors"

"github.com/cosmos/cosmos-sdk/x/authz"
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"

gaiaerrors "github.com/cosmos/gaia/v11/types/errors"
)

// initial deposit must be greater than or equal to 10% of the minimum deposit
Expand Down
11 changes: 5 additions & 6 deletions ante/gov_ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,18 @@ import (
"fmt"
"testing"

sdk "github.com/cosmos/cosmos-sdk/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/stretchr/testify/suite"
tmrand "github.com/tendermint/tendermint/libs/rand"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/testutil/testdata"
tmrand "github.com/tendermint/tendermint/libs/rand"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
sdk "github.com/cosmos/cosmos-sdk/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"

"github.com/cosmos/gaia/v11/ante"
gaiahelpers "github.com/cosmos/gaia/v11/app/helpers"

gaiaapp "github.com/cosmos/gaia/v11/app"
gaiahelpers "github.com/cosmos/gaia/v11/app/helpers"
)

var (
Expand Down
28 changes: 15 additions & 13 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@ import (
"os"
"path/filepath"

"github.com/gorilla/mux"
"github.com/rakyll/statik/fs"
"github.com/spf13/cast"
abci "github.com/tendermint/tendermint/abci/types"
tmjson "github.com/tendermint/tendermint/libs/json"
"github.com/tendermint/tendermint/libs/log"
tmos "github.com/tendermint/tendermint/libs/os"
dbm "github.com/tendermint/tm-db"

// unnamed import of statik for swagger UI support
_ "github.com/cosmos/cosmos-sdk/client/docs/statik"

ibctesting "github.com/cosmos/interchain-security/v2/legacy_ibc_testing/testing"
providertypes "github.com/cosmos/interchain-security/v2/x/ccv/provider/types"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
Expand All @@ -29,26 +44,13 @@ import (
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
ibctesting "github.com/cosmos/interchain-security/v2/legacy_ibc_testing/testing"
providertypes "github.com/cosmos/interchain-security/v2/x/ccv/provider/types"
"github.com/gorilla/mux"
"github.com/rakyll/statik/fs"
"github.com/spf13/cast"
abci "github.com/tendermint/tendermint/abci/types"
tmjson "github.com/tendermint/tendermint/libs/json"
"github.com/tendermint/tendermint/libs/log"
tmos "github.com/tendermint/tendermint/libs/os"
dbm "github.com/tendermint/tm-db"

gaiaante "github.com/cosmos/gaia/v11/ante"
"github.com/cosmos/gaia/v11/app/keepers"
gaiaappparams "github.com/cosmos/gaia/v11/app/params"
"github.com/cosmos/gaia/v11/app/upgrades"
v11 "github.com/cosmos/gaia/v11/app/upgrades/v11"
"github.com/cosmos/gaia/v11/x/globalfee"

// unnamed import of statik for swagger UI support
_ "github.com/cosmos/cosmos-sdk/client/docs/statik"
)

var (
Expand Down
3 changes: 2 additions & 1 deletion app/app_helpers.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package gaia

import (
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper"
ibcstakinginterface "github.com/cosmos/interchain-security/v2/legacy_ibc_testing/core"
icstest "github.com/cosmos/interchain-security/v2/testutil/integration"
ibcproviderkeeper "github.com/cosmos/interchain-security/v2/x/ccv/provider/keeper"

capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
)

// ProviderApp interface implementations for icstest tests
Expand Down
5 changes: 3 additions & 2 deletions app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package gaia_test
import (
"testing"

authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/libs/log"
db "github.com/tendermint/tm-db"

authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"

gaia "github.com/cosmos/gaia/v11/app"
gaiahelpers "github.com/cosmos/gaia/v11/app/helpers"
)
Expand Down
3 changes: 2 additions & 1 deletion app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package gaia
import (
"encoding/json"

tmproto "github.com/tendermint/tendermint/proto/tendermint/types"

servertypes "github.com/cosmos/cosmos-sdk/server/types"
sdk "github.com/cosmos/cosmos-sdk/types"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
"github.com/cosmos/cosmos-sdk/x/staking"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
)

// ExportAppStateAndValidators exports the state of the application for a genesis
Expand Down
12 changes: 6 additions & 6 deletions app/helpers/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ import (
"testing"
"time"

"github.com/stretchr/testify/require"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/libs/log"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
tmtypes "github.com/tendermint/tendermint/types"
dbm "github.com/tendermint/tm-db"

codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
Expand All @@ -15,12 +21,6 @@ import (
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/stretchr/testify/require"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
tmtypes "github.com/tendermint/tendermint/types"
dbm "github.com/tendermint/tm-db"

gaiaapp "github.com/cosmos/gaia/v11/app"
)
Expand Down
52 changes: 26 additions & 26 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
package keepers

import (
liquiditykeeper "github.com/gravity-devs/liquidity/x/liquidity/keeper"
liquiditytypes "github.com/gravity-devs/liquidity/x/liquidity/types"
"github.com/strangelove-ventures/packet-forward-middleware/v4/router"
routerkeeper "github.com/strangelove-ventures/packet-forward-middleware/v4/router/keeper"
routertypes "github.com/strangelove-ventures/packet-forward-middleware/v4/router/types"
tmos "github.com/tendermint/tendermint/libs/os"

// unnamed import of statik for swagger UI support
_ "github.com/cosmos/cosmos-sdk/client/docs/statik"

ica "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts"
icahost "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host"
icahostkeeper "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/keeper"
icahosttypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/types"
"github.com/cosmos/ibc-go/v4/modules/apps/transfer"
ibctransferkeeper "github.com/cosmos/ibc-go/v4/modules/apps/transfer/keeper"
ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
ibcclient "github.com/cosmos/ibc-go/v4/modules/core/02-client"
ibcclienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
porttypes "github.com/cosmos/ibc-go/v4/modules/core/05-port/types"
ibchost "github.com/cosmos/ibc-go/v4/modules/core/24-host"
ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper"
ibcprovider "github.com/cosmos/interchain-security/v2/x/ccv/provider"
ibcproviderkeeper "github.com/cosmos/interchain-security/v2/x/ccv/provider/keeper"
providertypes "github.com/cosmos/interchain-security/v2/x/ccv/provider/types"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/codec"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
Expand All @@ -22,12 +48,8 @@ import (
evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types"
"github.com/cosmos/cosmos-sdk/x/feegrant"
feegrantkeeper "github.com/cosmos/cosmos-sdk/x/feegrant/keeper"
providertypes "github.com/cosmos/interchain-security/v2/x/ccv/provider/types"
tmos "github.com/tendermint/tendermint/libs/os"

govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"

mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
"github.com/cosmos/cosmos-sdk/x/params"
Expand All @@ -41,30 +63,8 @@ import (
"github.com/cosmos/cosmos-sdk/x/upgrade"
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
ica "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts"
icahost "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host"
icahostkeeper "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/keeper"
icahosttypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/types"
"github.com/cosmos/ibc-go/v4/modules/apps/transfer"
ibctransferkeeper "github.com/cosmos/ibc-go/v4/modules/apps/transfer/keeper"
ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
ibcclient "github.com/cosmos/ibc-go/v4/modules/core/02-client"
ibcclienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
porttypes "github.com/cosmos/ibc-go/v4/modules/core/05-port/types"
ibchost "github.com/cosmos/ibc-go/v4/modules/core/24-host"
ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper"
ibcprovider "github.com/cosmos/interchain-security/v2/x/ccv/provider"
ibcproviderkeeper "github.com/cosmos/interchain-security/v2/x/ccv/provider/keeper"
liquiditykeeper "github.com/gravity-devs/liquidity/x/liquidity/keeper"
liquiditytypes "github.com/gravity-devs/liquidity/x/liquidity/types"
"github.com/strangelove-ventures/packet-forward-middleware/v4/router"
routerkeeper "github.com/strangelove-ventures/packet-forward-middleware/v4/router/keeper"
routertypes "github.com/strangelove-ventures/packet-forward-middleware/v4/router/types"

"github.com/cosmos/gaia/v11/x/globalfee"

// unnamed import of statik for swagger UI support
_ "github.com/cosmos/cosmos-sdk/client/docs/statik"
)

type AppKeepers struct {
Expand Down
14 changes: 8 additions & 6 deletions app/keepers/keys.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
package keepers

import (
liquiditytypes "github.com/gravity-devs/liquidity/x/liquidity/types"
routertypes "github.com/strangelove-ventures/packet-forward-middleware/v4/router/types"

icahosttypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/types"
ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
ibchost "github.com/cosmos/ibc-go/v4/modules/core/24-host"
providertypes "github.com/cosmos/interchain-security/v2/x/ccv/provider/types"

storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
Expand All @@ -16,12 +24,6 @@ import (
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
icahosttypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/types"
ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
ibchost "github.com/cosmos/ibc-go/v4/modules/core/24-host"
providertypes "github.com/cosmos/interchain-security/v2/x/ccv/provider/types"
liquiditytypes "github.com/gravity-devs/liquidity/x/liquidity/types"
routertypes "github.com/strangelove-ventures/packet-forward-middleware/v4/router/types"
)

func (appKeepers *AppKeepers) GenerateKeys() {
Expand Down
30 changes: 16 additions & 14 deletions app/modules.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
package gaia

import (
"github.com/gravity-devs/liquidity/x/liquidity"
liquiditytypes "github.com/gravity-devs/liquidity/x/liquidity/types"
"github.com/strangelove-ventures/packet-forward-middleware/v4/router"
routertypes "github.com/strangelove-ventures/packet-forward-middleware/v4/router/types"

ica "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts"
icatypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/types"
"github.com/cosmos/ibc-go/v4/modules/apps/transfer"
ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v4/modules/core"
ibcclientclient "github.com/cosmos/ibc-go/v4/modules/core/02-client/client"
ibchost "github.com/cosmos/ibc-go/v4/modules/core/24-host"
ibcprovider "github.com/cosmos/interchain-security/v2/x/ccv/provider"
ibcproviderclient "github.com/cosmos/interchain-security/v2/x/ccv/provider/client"
providertypes "github.com/cosmos/interchain-security/v2/x/ccv/provider/types"

"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/auth"
authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation"
Expand Down Expand Up @@ -38,20 +54,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/upgrade"
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
ica "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts"
icatypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/types"
"github.com/cosmos/ibc-go/v4/modules/apps/transfer"
ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v4/modules/core"
ibcclientclient "github.com/cosmos/ibc-go/v4/modules/core/02-client/client"
ibchost "github.com/cosmos/ibc-go/v4/modules/core/24-host"
ibcprovider "github.com/cosmos/interchain-security/v2/x/ccv/provider"
ibcproviderclient "github.com/cosmos/interchain-security/v2/x/ccv/provider/client"
providertypes "github.com/cosmos/interchain-security/v2/x/ccv/provider/types"
"github.com/gravity-devs/liquidity/x/liquidity"
liquiditytypes "github.com/gravity-devs/liquidity/x/liquidity/types"
"github.com/strangelove-ventures/packet-forward-middleware/v4/router"
routertypes "github.com/strangelove-ventures/packet-forward-middleware/v4/router/types"

gaiaappparams "github.com/cosmos/gaia/v11/app/params"
"github.com/cosmos/gaia/v11/x/globalfee"
Expand Down
4 changes: 2 additions & 2 deletions app/sim/sim_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import (
tmjson "github.com/tendermint/tendermint/libs/json"
tmtypes "github.com/tendermint/tendermint/types"

gaia "github.com/cosmos/gaia/v11/app"

"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
simappparams "github.com/cosmos/cosmos-sdk/simapp/params"
Expand All @@ -22,6 +20,8 @@ import (
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

gaia "github.com/cosmos/gaia/v11/app"
)

// AppStateFn returns the initial application state using a genesis or the simulation parameters.
Expand Down
Loading

0 comments on commit 69d1dd0

Please sign in to comment.