Skip to content

Commit

Permalink
chore: enable gci linter (#4159)
Browse files Browse the repository at this point in the history
  • Loading branch information
faddat committed May 20, 2024
1 parent 6f8df69 commit c22073b
Show file tree
Hide file tree
Showing 17 changed files with 49 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- uses: golangci/golangci-lint-action@v6
if: env.GIT_DIFF
with:
version: v1.54.2
version: v1.58.0
install-mode: goinstall
args: --timeout 10m
github-token: ${{ secrets.github_token }}
Expand Down
19 changes: 15 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
run:
tests: false
skip-dirs:
- ignite/ui
# # timeout for analysis, e.g. 30s, 5m, default is 1m
# timeout: 5m

linters:
disable-all: true
Expand All @@ -17,6 +13,7 @@ linters:
- errchkjson
- errorlint
- exhaustive
- gci
- goconst
- gocritic
- godot
Expand Down Expand Up @@ -47,6 +44,16 @@ linters:
# - wsl

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.
- prefix(cosmossdk.io)
- prefix(github.com/cosmos/cosmos-sdk)
- prefix(github.com/cosmos/ibc-go
- prefix(github.com/cometbft/cometbft)
- prefix(github.com/ignite/cli)
forbidigo:
forbid:
- p: ^fmt\.Errorf$
Expand All @@ -61,5 +68,9 @@ linters-settings:
desc: Should be replaced by '"github.com/ignite/cli/ignite/pkg/errors"'

issues:
exclude-dirs:
- ignite/ui
# # timeout for analysis, e.g. 30s, 5m, default is 1m
# timeout: 5m
max-issues-per-linter: 0
max-same-issues: 0
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

### Changes

- [#4159](https://github.com/ignite/cli/pull/4159) Enable gci linter
- [#4157](https://github.com/ignite/cli/pull/4157) Upgrade golang to 1.22
- [#4094](https://github.com/ignite/cli/pull/4094) Scaffolding a multi-index map using `ignite s map foo bar baz --index foobar,foobaz` is no longer supported. Use one index instead of use `collections.IndexedMap`.
- [#4058](https://github.com/ignite/cli/pull/4058) Simplify scaffolded modules by including `ValidateBasic()` logic in message handler.
Expand Down
3 changes: 2 additions & 1 deletion ignite/cmd/chain_faucet.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package ignitecmd

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

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

"github.com/ignite/cli/v29/ignite/pkg/chaincmd"
"github.com/ignite/cli/v29/ignite/pkg/cliui"
"github.com/ignite/cli/v29/ignite/services/chain"
Expand Down
3 changes: 2 additions & 1 deletion ignite/cmd/chain_simulate.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package ignitecmd
import (
"path/filepath"

"github.com/cosmos/cosmos-sdk/types/simulation"
"github.com/spf13/cobra"

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

"github.com/ignite/cli/v29/ignite/services/chain"
)

Expand Down
3 changes: 2 additions & 1 deletion ignite/cmd/node_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package ignitecmd
import (
"fmt"

"github.com/cosmos/cosmos-sdk/types/query"
"github.com/spf13/cobra"
flag "github.com/spf13/pflag"

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

"github.com/ignite/cli/v29/ignite/pkg/errors"
)

Expand Down
3 changes: 2 additions & 1 deletion ignite/cmd/node_tx_bank_send.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package ignitecmd

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

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

"github.com/ignite/cli/v29/ignite/pkg/cliui"
)

Expand Down
3 changes: 2 additions & 1 deletion ignite/config/chain/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import (
"io"
"os"

"github.com/cosmos/cosmos-sdk/types/bech32"
"gopkg.in/yaml.v3"

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

"github.com/ignite/cli/v29/ignite/config/chain/version"
"github.com/ignite/cli/v29/ignite/pkg/errors"
)
Expand Down
3 changes: 2 additions & 1 deletion ignite/pkg/cosmosaccount/cosmosaccount.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"os"

dkeyring "github.com/99designs/keyring"
"github.com/cosmos/go-bip39"

"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
Expand All @@ -15,7 +17,6 @@ import (
sdktypes "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/bech32"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/go-bip39"

"github.com/ignite/cli/v29/ignite/pkg/errors"
)
Expand Down
14 changes: 8 additions & 6 deletions ignite/pkg/cosmosclient/cosmosclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ import (
"time"

"github.com/cenkalti/backoff"
rpcclient "github.com/cometbft/cometbft/rpc/client"
rpchttp "github.com/cometbft/cometbft/rpc/client/http"
ctypes "github.com/cometbft/cometbft/rpc/core/types"
gogogrpc "github.com/cosmos/gogoproto/grpc"
"github.com/cosmos/gogoproto/proto"
prototypes "github.com/cosmos/gogoproto/types"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
Expand All @@ -30,9 +31,10 @@ import (
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
staking "github.com/cosmos/cosmos-sdk/x/staking/types"
gogogrpc "github.com/cosmos/gogoproto/grpc"
"github.com/cosmos/gogoproto/proto"
prototypes "github.com/cosmos/gogoproto/types"

rpcclient "github.com/cometbft/cometbft/rpc/client"
rpchttp "github.com/cometbft/cometbft/rpc/client/http"
ctypes "github.com/cometbft/cometbft/rpc/core/types"

"github.com/ignite/cli/v29/ignite/pkg/cosmosaccount"
"github.com/ignite/cli/v29/ignite/pkg/cosmosfaucet"
Expand Down
3 changes: 2 additions & 1 deletion ignite/pkg/cosmosclient/gasometer.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package cosmosclient

import (
gogogrpc "github.com/cosmos/gogoproto/grpc"

"github.com/cosmos/cosmos-sdk/client/tx"
sdktypes "github.com/cosmos/cosmos-sdk/types"
txtypes "github.com/cosmos/cosmos-sdk/types/tx"
gogogrpc "github.com/cosmos/gogoproto/grpc"
)

// gasometer implements the Gasometer interface.
Expand Down
1 change: 1 addition & 0 deletions ignite/pkg/cosmosfaucet/cosmosfaucet.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"time"

sdkmath "cosmossdk.io/math"

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

chaincmdrunner "github.com/ignite/cli/v29/ignite/pkg/chaincmd/runner"
Expand Down
1 change: 1 addition & 0 deletions ignite/pkg/cosmosfaucet/transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"time"

sdkmath "cosmossdk.io/math"

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

"github.com/ignite/cli/v29/ignite/pkg/chaincmd"
Expand Down
3 changes: 2 additions & 1 deletion ignite/pkg/cosmostxcollector/adapter/postgres/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import (
"fmt"
"net/url"

ctypes "github.com/cometbft/cometbft/rpc/core/types"
"github.com/lib/pq"

ctypes "github.com/cometbft/cometbft/rpc/core/types"

"github.com/ignite/cli/v29/ignite/pkg/cosmosclient"
"github.com/ignite/cli/v29/ignite/pkg/cosmostxcollector/query"
"github.com/ignite/cli/v29/ignite/pkg/errors"
Expand Down
4 changes: 3 additions & 1 deletion ignite/pkg/cosmosutil/gentx.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import (
"os"

sdkmath "cosmossdk.io/math"
"github.com/cometbft/cometbft/crypto/ed25519"

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

"github.com/cometbft/cometbft/crypto/ed25519"

"github.com/ignite/cli/v29/ignite/pkg/errors"
)

Expand Down
1 change: 1 addition & 0 deletions ignite/services/chain/faucet.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"time"

sdkmath "cosmossdk.io/math"

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

chainconfig "github.com/ignite/cli/v29/ignite/config/chain"
Expand Down
3 changes: 2 additions & 1 deletion ignite/services/chain/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import (
"os"
"path/filepath"

sdktypes "github.com/cosmos/cosmos-sdk/types"
"github.com/nqd/flat"
"github.com/pelletier/go-toml"

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

chainconfig "github.com/ignite/cli/v29/ignite/config/chain"
"github.com/ignite/cli/v29/ignite/pkg/chaincmd"
chaincmdrunner "github.com/ignite/cli/v29/ignite/pkg/chaincmd/runner"
Expand Down

0 comments on commit c22073b

Please sign in to comment.