Skip to content

Commit 1652a06

Browse files
authored
chore: linter upgrade to v2 (#2354)
1 parent 46c3975 commit 1652a06

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+218
-217
lines changed

.github/workflows/golangci-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
uses: golangci/golangci-lint-action@v8
7272
with:
7373
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
74-
version: v1.64.8
74+
version: v2.1
7575

7676
# Optional: working directory, useful for monorepos
7777
# working-directory: somedir

.golangci.yml

Lines changed: 66 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,71 @@
1-
# Options for analysis running. See https://golangci-lint.run/usage/configuration/ for config options.
2-
run:
3-
timeout: 5m
4-
issues:
5-
max-issues-per-linter: 0 # infinite
6-
max-same-issues: 0 # infinite
7-
fix: true
8-
exclude:
9-
# see https://github.com/stretchr/testify/issues/1199#issuecomment-1215592618, testify shows vet problem
10-
- 'github.com\/stretchr\/testify\/suite\.Suite contains sync\.RWMutex'
1+
version: "2"
112
linters:
123
enable:
13-
- whitespace
14-
- goimports
154
- importas
16-
disable:
17-
- typecheck
18-
linters-settings:
19-
misspell:
20-
locale: US
21-
goimports:
22-
# Put imports beginning with prefix after 3rd-party packages.
23-
# It's a comma-separated list of prefixes.
24-
local-prefixes: github.com/NibiruChain/nibiru
25-
revive:
5+
- whitespace
6+
settings:
7+
importas:
8+
alias:
9+
- pkg: github.com/pkg/errors
10+
alias: pkgerrors
11+
- pkg: cosmossdk.io/errors
12+
alias: sdkioerrors
13+
- pkg: github.com/cosmos/cosmos-sdk/types/errors
14+
alias: sdkerrors
15+
- pkg: cosmossdk.io/math
16+
alias: sdkmath
17+
- pkg: github.com/cosmos/cosmos-sdk/types
18+
alias: sdk
19+
- pkg: github.com/cometbft/cometbft/rpc/core
20+
alias: cmtrpccoretypes
21+
- pkg: github.com/cometbft/cometbft/rpc/client
22+
alias: cmtrpcclient
23+
- pkg: github.com/cometbft/cometbft/config
24+
alias: cmtcfg
25+
- pkg: github.com/cometbft/cometbft/libs/cli
26+
alias: cmtcli
27+
- pkg: github.com/cometbft/cometbft/libs/rand
28+
alias: cmtrand
29+
- pkg: github.com/cometbft/cometbft/types
30+
alias: cmttypes
31+
no-unaliased: true
32+
no-extra-aliases: false
33+
misspell:
34+
locale: US
35+
revive:
36+
rules:
37+
- name: exported
38+
disabled: true
39+
exclusions:
40+
generated: lax
41+
presets:
42+
- comments
43+
- common-false-positives
44+
- legacy
45+
- std-error-handling
2646
rules:
27-
- name: exported
28-
disabled: true
29-
importas:
30-
# no-unaliased: Forces the use of the specified alias
31-
no-unaliased: true
32-
# Disallows the use of aliases not specified by the linter.
33-
no-extra-aliases: false
34-
alias:
35-
- pkg: github.com/pkg/errors
36-
alias: pkgerrors
37-
- pkg: cosmossdk.io/errors
38-
alias: sdkioerrors
39-
- pkg: github.com/cosmos/cosmos-sdk/types/errors
40-
alias: sdkerrors
41-
- pkg: cosmossdk.io/math
42-
alias: sdkmath
43-
- pkg: github.com/cosmos/cosmos-sdk/types
44-
alias: sdk
45-
- pkg: github.com/cometbft/cometbft/rpc/core
46-
alias: cmtrpccoretypes
47-
- pkg: github.com/cometbft/cometbft/rpc/client
48-
alias: cmtrpcclient
49-
- pkg: github.com/cometbft/cometbft/config
50-
alias: cmtcfg
51-
- pkg: github.com/cometbft/cometbft/libs/cli
52-
alias: cmtcli
53-
- pkg: github.com/cometbft/cometbft/libs/rand
54-
alias: cmtrand
55-
- pkg: github.com/cometbft/cometbft/types
56-
alias: cmttypes
57-
47+
- path: (.+)\.go$
48+
text: github.com\/stretchr\/testify\/suite\.Suite contains sync\.RWMutex
49+
paths:
50+
- third_party$
51+
- builtin$
52+
- examples$
53+
issues:
54+
max-issues-per-linter: 0
55+
max-same-issues: 0
56+
fix: true
5857
severity:
59-
default-severity: error
58+
default: error
59+
formatters:
60+
enable:
61+
- goimports
62+
settings:
63+
goimports:
64+
local-prefixes:
65+
- github.com/NibiruChain/nibiru
66+
exclusions:
67+
generated: lax
68+
paths:
69+
- third_party$
70+
- builtin$
71+
- examples$

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ See https://github.com/dangoslen/changelog-enforcer.
5454
- [#2348](https://github.com/NibiruChain/nibiru/pull/2348) - fix(oracle): max expiration a label rather than an invalidation for additional query liveness
5555
- [#2350](https://github.com/NibiruChain/nibiru/pull/2350) - fix(simapp): sim tests with empty validator set panic
5656
- [#2352](https://github.com/NibiruChain/nibiru/pull/2352) - chore(token-registry): Add bank coin versions of USDC and USDT from Stargate and LayerZero, and update ErisEvm.sol to fix redeem
57+
- [#2354](https://github.com/NibiruChain/nibiru/pull/2354) - chore: linter upgrade to v2
5758

5859
### Dependencies
5960
- Bump `form-data` from 4.0.1 to 4.0.4 ([#2347](https://github.com/NibiruChain/nibiru/pull/2347))

app/app.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ func NewNibiruApp(
386386
cryptocodec.RegisterCrypto(app.legacyAmino)
387387

388388
// load state streaming if enabled
389-
if _, _, err := streaming.LoadStreamingServices(app.App.BaseApp, appOpts, app.appCodec, logger, app.kvStoreKeys()); err != nil {
389+
if _, _, err := streaming.LoadStreamingServices(app.BaseApp, appOpts, app.appCodec, logger, app.kvStoreKeys()); err != nil {
390390
logger.Error("failed to load state streaming", "err", err)
391391
os.Exit(1)
392392
}
@@ -465,7 +465,7 @@ func NewNibiruApp(
465465

466466
if loadLatest {
467467
// Initialize pinned codes in wasmvm as they are not persisted there
468-
if err := ibcwasmkeeper.InitializePinnedCodes(app.BaseApp.NewUncachedContext(true, cmtproto.Header{}), app.appCodec); err != nil {
468+
if err := ibcwasmkeeper.InitializePinnedCodes(app.NewUncachedContext(true, cmtproto.Header{}), app.appCodec); err != nil {
469469
cmtos.Exit(fmt.Sprintf("failed to initialize pinned codes %s", err))
470470
}
471471
}
@@ -591,15 +591,15 @@ func (app *NibiruApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.API
591591
// RegisterTxService implements the Application.RegisterTxService method.
592592
func (app *NibiruApp) RegisterTxService(clientCtx client.Context) {
593593
authtx.RegisterTxService(
594-
app.BaseApp.GRPCQueryRouter(), clientCtx,
595-
app.BaseApp.Simulate, app.interfaceRegistry)
594+
app.GRPCQueryRouter(), clientCtx,
595+
app.Simulate, app.interfaceRegistry)
596596
}
597597

598598
// RegisterTendermintService implements the Application.RegisterTendermintService method.
599599
func (app *NibiruApp) RegisterTendermintService(clientCtx client.Context) {
600600
tmservice.RegisterTendermintService(
601601
clientCtx,
602-
app.BaseApp.GRPCQueryRouter(),
602+
app.GRPCQueryRouter(),
603603
app.interfaceRegistry,
604604
app.Query,
605605
)

app/app_config.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,12 @@ import (
5555
"github.com/NibiruChain/nibiru/v2/x/common"
5656
devgastypes "github.com/NibiruChain/nibiru/v2/x/devgas/v1/types"
5757
epochstypes "github.com/NibiruChain/nibiru/v2/x/epochs/types"
58-
"github.com/NibiruChain/nibiru/v2/x/evm"
5958
evmtypes "github.com/NibiruChain/nibiru/v2/x/evm"
6059
"github.com/NibiruChain/nibiru/v2/x/genmsg"
6160
inflationtypes "github.com/NibiruChain/nibiru/v2/x/inflation/types"
6261
oracletypes "github.com/NibiruChain/nibiru/v2/x/oracle/types"
6362
sudotypes "github.com/NibiruChain/nibiru/v2/x/sudo/types"
6463
tftypes "github.com/NibiruChain/nibiru/v2/x/tokenfactory/types"
65-
tokenfactorytypes "github.com/NibiruChain/nibiru/v2/x/tokenfactory/types"
6664
)
6765

6866
var (
@@ -77,12 +75,12 @@ var (
7775
ibcfeetypes.ModuleName,
7876
icatypes.ModuleName,
7977

80-
evm.ModuleName,
78+
evmtypes.ModuleName,
8179
epochstypes.ModuleName,
8280
sudotypes.ModuleName,
8381
common.TreasuryPoolModuleAccount,
8482
wasmtypes.ModuleName,
85-
tokenfactorytypes.ModuleName,
83+
tftypes.ModuleName,
8684
}
8785

8886
// module account permissions
@@ -98,12 +96,12 @@ var (
9896
{Account: ibcfeetypes.ModuleName},
9997
{Account: icatypes.ModuleName},
10098

101-
{Account: evm.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner}},
99+
{Account: evmtypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner}},
102100
{Account: epochstypes.ModuleName},
103101
{Account: sudotypes.ModuleName},
104102
{Account: common.TreasuryPoolModuleAccount},
105103
{Account: wasmtypes.ModuleName, Permissions: []string{authtypes.Burner}},
106-
{Account: tokenfactorytypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner}},
104+
{Account: tftypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner}},
107105
}
108106

109107
orderedModuleNames = []string{
@@ -158,13 +156,13 @@ var (
158156
ibcwasmtypes.ModuleName,
159157

160158
// --------------------------------------------------------------------
161-
evm.ModuleName,
159+
evmtypes.ModuleName,
162160

163161
// --------------------------------------------------------------------
164162
// CosmWasm
165163
wasmtypes.ModuleName,
166164
devgastypes.ModuleName,
167-
tokenfactorytypes.ModuleName,
165+
tftypes.ModuleName,
168166

169167
// Everything else should be before genmsg
170168
genmsg.ModuleName,

app/evmante/evmante_can_transfer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type CanTransferDecorator struct {
2424
func (ctd CanTransferDecorator) AnteHandle(
2525
ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler,
2626
) (sdk.Context, error) {
27-
ethCfg := evm.EthereumConfig(ctd.EVMKeeper.EthChainID(ctx))
27+
ethCfg := evm.EthereumConfig(ctd.EthChainID(ctx))
2828
signer := gethcore.MakeSigner(
2929
ethCfg,
3030
big.NewInt(ctx.BlockHeight()),
@@ -40,7 +40,7 @@ func (ctd CanTransferDecorator) AnteHandle(
4040
)
4141
}
4242

43-
baseFeeWeiPerGas := evm.NativeToWei(ctd.EVMKeeper.BaseFeeMicronibiPerGas(ctx))
43+
baseFeeWeiPerGas := evm.NativeToWei(ctd.BaseFeeMicronibiPerGas(ctx))
4444

4545
evmMsg, err := msgEthTx.AsMessage(signer, baseFeeWeiPerGas)
4646
if err != nil {

app/evmante/evmante_can_transfer_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func (s *TestSuite) TestCanTransferDecorator() {
8888
s.Run(tc.name, func() {
8989
deps := evmtest.NewTestDeps()
9090
stateDB := deps.NewStateDB()
91-
anteDec := evmante.CanTransferDecorator{deps.App.AppKeepers.EvmKeeper}
91+
anteDec := evmante.CanTransferDecorator{deps.App.EvmKeeper}
9292
tx := tc.txSetup(&deps)
9393

9494
if tc.beforeTxSetup != nil {

app/evmante/evmante_emit_event_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func (s *TestSuite) TestEthEmitEventDecorator() {
4242
s.Run(tc.name, func() {
4343
deps := evmtest.NewTestDeps()
4444
stateDB := deps.NewStateDB()
45-
anteDec := evmante.NewEthEmitEventDecorator(deps.App.AppKeepers.EvmKeeper)
45+
anteDec := evmante.NewEthEmitEventDecorator(deps.App.EvmKeeper)
4646

4747
tx := tc.txSetup(&deps)
4848
s.Require().NoError(stateDB.Commit())

app/evmante/evmante_gas_consume_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func (s *TestSuite) TestAnteDecEthGasConsume() {
6161
deps := evmtest.NewTestDeps()
6262
stateDB := deps.NewStateDB()
6363
anteDec := evmante.NewAnteDecEthGasConsume(
64-
deps.App.AppKeepers.EvmKeeper, tc.maxGasWanted,
64+
deps.App.EvmKeeper, tc.maxGasWanted,
6565
)
6666

6767
tc.beforeTxSetup(&deps, stateDB)

app/evmante/evmante_mempool_fees_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func (s *TestSuite) TestMempoolGasFeeDecorator() {
8282
for _, tc := range testCases {
8383
s.Run(tc.name, func() {
8484
deps := evmtest.NewTestDeps()
85-
anteDec := evmante.NewMempoolGasPriceDecorator(deps.App.AppKeepers.EvmKeeper)
85+
anteDec := evmante.NewMempoolGasPriceDecorator(deps.App.EvmKeeper)
8686

8787
tx := tc.txSetup(&deps)
8888

0 commit comments

Comments
 (0)