Skip to content

Commit

Permalink
ci(lint): add gci and avoid deprecated packages (#388)
Browse files Browse the repository at this point in the history
  • Loading branch information
faddat authored Jun 19, 2023
1 parent 7bf9a42 commit f0d8b3e
Show file tree
Hide file tree
Showing 94 changed files with 374 additions and 248 deletions.
20 changes: 18 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
run:
timeout: 10m

linters:
disable-all: true
enable:
Expand All @@ -23,6 +24,7 @@ linters:
- exportloopref
- funlen
- forbidigo
- gci
- gocognit
- goconst
- gocritic
Expand Down Expand Up @@ -52,6 +54,20 @@ linters:
- whitespace

linters-settings:
gci:
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(cosmossdk.io) # cosmossdk.io
- prefix(github.com/cosmos/cosmos-sdk) # cosmos-sdk & cosmos org libs
- prefix(github.com/cosmos/interchain-security) # interchain-security
- prefix(github.com/cosmos/ibc-go) # ibc
- prefix( github.com/okp4/okp4d) # okp4
custom-order: true

cyclop:
max-complexity: 20
skip-tests: true
Expand All @@ -71,10 +87,10 @@ issues:
- source: "^//\\s*go:generate\\s"
linters:
- lll
- source: "(noinspection|TODO)"
- source: '(noinspection|TODO)'
linters:
- godot
- source: "//noinspection"
- source: '//noinspection'
linters:
- gocritic
- source: "^\\s+if _, ok := err\\.\\([^.]+\\.InternalError\\); ok {"
Expand Down
12 changes: 7 additions & 5 deletions app/ante.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
package app

import (
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types"

errorsmod "cosmossdk.io/errors"

storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/auth/ante"

ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante"
"github.com/cosmos/ibc-go/v7/modules/core/keeper"

wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types"
)

// HandlerOptions extend the SDK's AnteHandler options by requiring the IBC
Expand All @@ -28,13 +30,13 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "account keeper is required for AnteHandler")
}
if options.BankKeeper == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "bank keeper is required for AnteHandler")
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "bank keeper is required for AnteHandler")
}
if options.SignModeHandler == nil {
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder")
}
if options.WasmConfig == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "wasm config is required for ante builder")
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "wasm config is required for ante builder")
}
if options.TXCounterStoreKey == nil {
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "tx counter key is required for ante builder")
Expand Down
41 changes: 21 additions & 20 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,34 @@ import (
"path/filepath"
"strings"

autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1"
"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
"github.com/ignite/cli/ignite/pkg/openapiconsole"
appparams "github.com/okp4/okp4d/app/params"
okp4wasm "github.com/okp4/okp4d/app/wasm"
"github.com/okp4/okp4d/docs"
logicmodule "github.com/okp4/okp4d/x/logic"
logicfs "github.com/okp4/okp4d/x/logic/fs"
logicmodulekeeper "github.com/okp4/okp4d/x/logic/keeper"
logicmoduletypes "github.com/okp4/okp4d/x/logic/types"
"github.com/okp4/okp4d/x/mint"
mintkeeper "github.com/okp4/okp4d/x/mint/keeper"
minttypes "github.com/okp4/okp4d/x/mint/types"
"github.com/okp4/okp4d/x/vesting"
vestingtypes "github.com/okp4/okp4d/x/vesting/types"
"github.com/prometheus/client_golang/prometheus"
"github.com/spf13/cast"

dbm "github.com/cometbft/cometbft-db"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cometbft/cometbft/libs/log"
tmos "github.com/cometbft/cometbft/libs/os"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"

autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
Expand Down Expand Up @@ -91,6 +109,7 @@ import (
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts"
icacontroller "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller"
icacontrollerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper"
Expand All @@ -114,24 +133,6 @@ import (
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
solomachine "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine"
ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
okp4wasm "github.com/okp4/okp4d/app/wasm"
logicmodule "github.com/okp4/okp4d/x/logic"
logicfs "github.com/okp4/okp4d/x/logic/fs"
logicmodulekeeper "github.com/okp4/okp4d/x/logic/keeper"
logicmoduletypes "github.com/okp4/okp4d/x/logic/types"
"github.com/okp4/okp4d/x/mint"
mintkeeper "github.com/okp4/okp4d/x/mint/keeper"
minttypes "github.com/okp4/okp4d/x/mint/types"
"github.com/prometheus/client_golang/prometheus"
"github.com/spf13/cast"

"github.com/okp4/okp4d/x/vesting"
vestingtypes "github.com/okp4/okp4d/x/vesting/types"

"github.com/ignite/cli/ignite/pkg/openapiconsole"
appparams "github.com/okp4/okp4d/app/params"

"github.com/okp4/okp4d/docs"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions app/encoding.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package app

import (
"github.com/okp4/okp4d/app/params"

"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/std"
"github.com/cosmos/cosmos-sdk/x/auth/tx"

"github.com/okp4/okp4d/app/params"
)

// makeEncodingConfig creates an EncodingConfig for an amino based test configuration.
Expand Down
5 changes: 3 additions & 2 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package app
import (
"fmt"

storetypes "github.com/cosmos/cosmos-sdk/store/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
v4 "github.com/okp4/okp4d/app/upgrades/v4"
v41 "github.com/okp4/okp4d/app/upgrades/v41"
v5 "github.com/okp4/okp4d/app/upgrades/v5"

storetypes "github.com/cosmos/cosmos-sdk/store/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
)

func (app *App) setupUpgradeHandlers() {
Expand Down
2 changes: 2 additions & 0 deletions app/upgrades/v5/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package v5

import (
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"

"github.com/cosmos/cosmos-sdk/baseapp"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand All @@ -19,6 +20,7 @@ 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"

icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"
icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types"
ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
Expand Down
11 changes: 7 additions & 4 deletions app/wasm/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ import (

wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
logickeeper "github.com/okp4/okp4d/x/logic/keeper"
logicwasm "github.com/okp4/okp4d/x/logic/wasm"

errorsmod "cosmossdk.io/errors"

sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)

// customQuery represents the wasm custom query structure, it is intended to allow wasm contracts to execute queries
Expand All @@ -31,13 +34,13 @@ func makeCustomQuerier(logicQuerier logicwasm.LogicQuerier) wasmkeeper.CustomQue
return func(ctx sdk.Context, request json.RawMessage) ([]byte, error) {
var query customQuery
if err := json.Unmarshal(request, &query); err != nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error())
return nil, errorsmod.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error())
}

if query.Ask != nil {
return logicQuerier.Ask(ctx, *query.Ask)
}

return nil, sdkerrors.Wrap(wasmtypes.ErrInvalidMsg, "Unknown custom query variant")
return nil, errorsmod.Wrap(wasmtypes.ErrInvalidMsg, "Unknown custom query variant")
}
}
4 changes: 2 additions & 2 deletions cmd/okp4d/cmd/config.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package cmd

import (
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/okp4/okp4d/app"

sdk "github.com/cosmos/cosmos-sdk/types"
)

func initSDKConfig() {
Expand Down
2 changes: 1 addition & 1 deletion cmd/okp4d/cmd/genaccounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"errors"
"fmt"

authvesting "github.com/okp4/okp4d/x/vesting/types"
"github.com/spf13/cobra"

"github.com/cosmos/cosmos-sdk/client"
Expand All @@ -17,7 +18,6 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
authvesting "github.com/okp4/okp4d/x/vesting/types"
)

const (
Expand Down
15 changes: 7 additions & 8 deletions cmd/okp4d/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,18 @@ import (
"path/filepath"
"strings"

"github.com/okp4/okp4d/app"
appparams "github.com/okp4/okp4d/app/params"
"github.com/spf13/cast"
"github.com/spf13/cobra"
"github.com/spf13/pflag"

dbm "github.com/cometbft/cometbft-db"
tmcfg "github.com/cometbft/cometbft/config"
tmcli "github.com/cometbft/cometbft/libs/cli"
"github.com/cometbft/cometbft/libs/log"
tmtypes "github.com/cometbft/cometbft/types"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/config"
Expand All @@ -33,14 +40,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/genutil"
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
"github.com/spf13/cast"
"github.com/spf13/cobra"
"github.com/spf13/pflag"

// this line is used by starport scaffolding # root/moduleImport.

"github.com/okp4/okp4d/app"
appparams "github.com/okp4/okp4d/app/params"
)

// NewRootCmd creates a new root command for a Cosmos SDK application.
Expand Down
6 changes: 3 additions & 3 deletions cmd/okp4d/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
"errors"
"os"

"github.com/cosmos/cosmos-sdk/server"
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
"github.com/okp4/okp4d/app"
"github.com/okp4/okp4d/cmd/okp4d/cmd"

"github.com/okp4/okp4d/app"
"github.com/cosmos/cosmos-sdk/server"
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/okp4/okp4d

go 1.19
go 1.20

require (
cosmossdk.io/api v0.3.1
Expand Down
4 changes: 2 additions & 2 deletions scripts/generate_command_doc.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"log"
"os"

"github.com/cosmos/cosmos-sdk/server"
"github.com/okp4/okp4d/cmd/okp4d/cmd"
"github.com/spf13/cobra/doc"

"github.com/okp4/okp4d/cmd/okp4d/cmd"
"github.com/cosmos/cosmos-sdk/server"
)

func main() {
Expand Down
3 changes: 2 additions & 1 deletion testutil/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import (
"time"

"github.com/okp4/okp4d/app"
"github.com/stretchr/testify/require"

tmdb "github.com/cometbft/cometbft-db"
tmrand "github.com/cometbft/cometbft/libs/rand"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/crypto/hd"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
Expand All @@ -18,7 +20,6 @@ import (
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/stretchr/testify/require"
)

type (
Expand Down
3 changes: 1 addition & 2 deletions x/logic/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ package cli
import (
"fmt"

"github.com/okp4/okp4d/x/logic/types"
"github.com/spf13/cobra"

"github.com/cosmos/cosmos-sdk/client"

"github.com/okp4/okp4d/x/logic/types"
)

// GetQueryCmd returns the cli query commands for this module.
Expand Down
5 changes: 3 additions & 2 deletions x/logic/client/cli/query_ask.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import (
"io"
"os"

"github.com/okp4/okp4d/x/logic/types"
"github.com/spf13/cobra"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/version"
"github.com/okp4/okp4d/x/logic/types"
"github.com/spf13/cobra"
)

var (
Expand Down
5 changes: 3 additions & 2 deletions x/logic/client/cli/query_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package cli
import (
"context"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/okp4/okp4d/x/logic/types"
"github.com/spf13/cobra"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
)

func CmdQueryParams() *cobra.Command {
Expand Down
Loading

0 comments on commit f0d8b3e

Please sign in to comment.