Skip to content

Commit be61b46

Browse files
committed
clean up formatting
1 parent 4021b9a commit be61b46

25 files changed

+187
-222
lines changed

x/feeabs/types/codec_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ package types
33
import (
44
"testing"
55

6+
"github.com/stretchr/testify/require"
7+
68
"github.com/cosmos/cosmos-sdk/codec"
79
"github.com/cosmos/cosmos-sdk/codec/types"
810
sdk "github.com/cosmos/cosmos-sdk/types"
9-
"github.com/stretchr/testify/require"
1011
)
1112

1213
func TestRegisterCodec(t *testing.T) {

x/feeabs/types/errors_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ package types
33
import (
44
"testing"
55

6-
sdkerrors "cosmossdk.io/errors"
76
"github.com/stretchr/testify/require"
7+
8+
sdkerrors "cosmossdk.io/errors"
89
)
910

1011
func TestErrors(t *testing.T) {

x/feeabs/types/ibc_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ import (
44
"testing"
55
"time"
66

7-
abci "github.com/cometbft/cometbft/abci/types"
87
"github.com/stretchr/testify/require"
8+
9+
abci "github.com/cometbft/cometbft/abci/types"
910
)
1011

1112
func TestIBCConstants(t *testing.T) {

x/feeabs/types/msg_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ package types
33
import (
44
"testing"
55

6+
"github.com/stretchr/testify/require"
7+
68
"cosmossdk.io/math"
9+
710
sdk "github.com/cosmos/cosmos-sdk/types"
8-
"github.com/stretchr/testify/require"
911
)
1012

1113
func TestMsgSendQueryIbcDenomTWAP(t *testing.T) {

x/feeabs/types/params.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ func (p Params) Validate() error {
6363
return err
6464
}
6565

66-
6766
return nil
6867
}
6968

x/feeabs/types/params_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ import (
44
"fmt"
55
"testing"
66

7-
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
87
"github.com/stretchr/testify/assert"
98
"github.com/stretchr/testify/require"
9+
10+
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
1011
)
1112

1213
func Test_ParamString(t *testing.T) {
@@ -580,4 +581,3 @@ func TestParamsValidateViaParamSetPairs(t *testing.T) {
580581
}
581582
})
582583
}
583-

x/feeabs/types/proposal_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ package types
33
import (
44
"testing"
55

6-
v1beta1types "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
76
"github.com/stretchr/testify/require"
7+
8+
v1beta1types "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
89
)
910

1011
func TestProposalConstants(t *testing.T) {

x/globalfee/ante/fee_test.go

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ import (
2121
"github.com/burnt-labs/xion/x/globalfee/types"
2222
)
2323

24+
const (
25+
testStakingDenom = "stake"
26+
)
27+
2428
func TestNewFeeDecorator(t *testing.T) {
2529
// Create a test subspace without key table
2630
storeKey := storetypes.NewKVStoreKey(paramstypes.StoreKey)
@@ -34,9 +38,7 @@ func TestNewFeeDecorator(t *testing.T) {
3438
types.ModuleName,
3539
)
3640

37-
stakingDenomFunc := func(ctx sdk.Context) string {
38-
return "stake"
39-
}
41+
stakingDenomFunc := func(ctx sdk.Context) string { return testStakingDenom }
4042

4143
// Test with subspace that doesn't have key table - should panic
4244
require.Panics(t, func() {
@@ -71,9 +73,7 @@ func TestFeeDecoratorMethods(t *testing.T) {
7173
}
7274
subspace.SetParamSet(ctx.Ctx, &params)
7375

74-
stakingDenomFunc := func(ctx sdk.Context) string {
75-
return "stake"
76-
}
76+
stakingDenomFunc := func(ctx sdk.Context) string { return testStakingDenom }
7777

7878
decorator := ante.NewFeeDecorator(subspace, stakingDenomFunc)
7979

@@ -89,7 +89,7 @@ func TestFeeDecoratorMethods(t *testing.T) {
8989
require.NoError(t, err)
9090
require.NotNil(t, zeroFees)
9191
require.Len(t, zeroFees, 1)
92-
require.Equal(t, "stake", zeroFees[0].Denom)
92+
require.Equal(t, testStakingDenom, zeroFees[0].Denom)
9393
require.True(t, zeroFees[0].Amount.IsZero())
9494

9595
// Test ContainsOnlyBypassMinFeeMsgs
@@ -147,9 +147,7 @@ func TestGetGlobalFeeEmptyParams(t *testing.T) {
147147
}
148148
subspace.SetParamSet(ctx.Ctx, &params)
149149

150-
stakingDenomFunc := func(ctx sdk.Context) string {
151-
return "stake"
152-
}
150+
stakingDenomFunc := func(ctx sdk.Context) string { return testStakingDenom }
153151

154152
decorator := ante.NewFeeDecorator(subspace, stakingDenomFunc)
155153

@@ -158,7 +156,7 @@ func TestGetGlobalFeeEmptyParams(t *testing.T) {
158156
require.NoError(t, err)
159157
require.NotNil(t, globalFees)
160158
require.Len(t, globalFees, 1)
161-
require.Equal(t, "stake", globalFees[0].Denom)
159+
require.Equal(t, testStakingDenom, globalFees[0].Denom)
162160
require.True(t, globalFees[0].Amount.IsZero())
163161
}
164162

@@ -216,9 +214,7 @@ func TestContainsOnlyBypassMinFeeMsgsEdgeCases(t *testing.T) {
216214
types.ModuleName,
217215
).WithKeyTable(types.ParamKeyTable())
218216

219-
stakingDenomFunc := func(ctx sdk.Context) string {
220-
return "stake"
221-
}
217+
stakingDenomFunc := func(ctx sdk.Context) string { return testStakingDenom }
222218

223219
decorator := ante.NewFeeDecorator(subspace, stakingDenomFunc)
224220

@@ -310,9 +306,7 @@ func TestContainsOnlyBypassMinFeeMsgsWithMessages(t *testing.T) {
310306
types.ModuleName,
311307
).WithKeyTable(types.ParamKeyTable())
312308

313-
stakingDenomFunc := func(ctx sdk.Context) string {
314-
return "stake"
315-
}
309+
stakingDenomFunc := func(ctx sdk.Context) string { return testStakingDenom }
316310

317311
decorator := ante.NewFeeDecorator(subspace, stakingDenomFunc)
318312

@@ -450,9 +444,7 @@ func TestAnteHandle(t *testing.T) {
450444
params := types.DefaultParams()
451445
subspace.SetParamSet(ctx.Ctx, &params)
452446

453-
stakingDenomFunc := func(ctx sdk.Context) string {
454-
return "stake"
455-
}
447+
stakingDenomFunc := func(ctx sdk.Context) string { return testStakingDenom }
456448

457449
decorator := ante.NewFeeDecorator(subspace, stakingDenomFunc)
458450

x/globalfee/client/cli/query_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ import (
44
"context"
55
"testing"
66

7-
rpcclientmock "github.com/cometbft/cometbft/rpc/client/mock"
87
"github.com/stretchr/testify/require"
98

9+
rpcclientmock "github.com/cometbft/cometbft/rpc/client/mock"
10+
1011
"github.com/cosmos/cosmos-sdk/client"
1112
"github.com/cosmos/cosmos-sdk/client/flags"
1213
"github.com/cosmos/cosmos-sdk/crypto/keyring"
@@ -192,7 +193,8 @@ func TestGetCmdShowGlobalFeeParamsRunEErrorPath(t *testing.T) {
192193

193194
// Test RunE with no client context (should panic, which we recover)
194195
require.Panics(t, func() {
195-
cmd.RunE(cmd, []string{})
196+
// capture error value explicitly to satisfy errcheck while still triggering panic path
197+
_ = cmd.RunE(cmd, []string{})
196198
}, "Expected panic when no client context is set")
197199
}
198200

x/globalfee/module.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ var (
3434
// AppModuleBasic defines the basic application module used by the wasm module.
3535
type AppModuleBasic struct{}
3636

37+
// reused literal to avoid triggering goconst / allow inline explanatory comments
38+
const noOp = "no-op"
39+
3740
func (a AppModuleBasic) Name() string {
3841
return types.ModuleName
3942
}
@@ -58,12 +61,12 @@ func (a AppModuleBasic) ValidateGenesis(marshaler codec.JSONCodec, _ client.TxEn
5861

5962
func (a AppModuleBasic) RegisterInterfaces(_ codectypes.InterfaceRegistry) {
6063
// No interfaces to register for globalfee module
61-
_ = "no-op"
64+
_ = noOp
6265
}
6366

6467
func (a AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {
6568
// No REST routes to register for globalfee module
66-
_ = "no-op"
69+
_ = noOp
6770
}
6871

6972
// RegisterQueryHandlerClientFn is an overrideable hook (exported for tests) used to register
@@ -89,7 +92,7 @@ func (a AppModuleBasic) GetQueryCmd() *cobra.Command {
8992

9093
func (a AppModuleBasic) RegisterLegacyAminoCodec(_ *codec.LegacyAmino) {
9194
// No legacy amino codec registration needed for globalfee module
92-
_ = "no-op"
95+
_ = noOp
9396
}
9497

9598
type AppModule struct {
@@ -99,12 +102,12 @@ type AppModule struct {
99102

100103
func (a AppModule) IsOnePerModuleType() {
101104
// Interface marker method - indicates this module should only be instantiated once per chain
102-
_ = "no-op"
105+
_ = noOp
103106
}
104107

105108
func (a AppModule) IsAppModule() {
106109
// Interface marker method - indicates this implements the AppModule interface
107-
_ = "no-op"
110+
_ = noOp
108111
}
109112

110113
// NewAppModule constructor
@@ -131,7 +134,8 @@ func (a AppModule) ExportGenesis(ctx sdk.Context, marshaler codec.JSONCodec) jso
131134
}
132135

133136
func (a AppModule) RegisterServices(cfg module.Configurator) {
134-
types.RegisterQueryServer(cfg.QueryServer(), NewGrpcQuerier(a.globalfeeSubspace))
137+
// inline creation of GrpcQuerier to avoid potential build tag / symbol resolution issues during linting
138+
types.RegisterQueryServer(cfg.QueryServer(), GrpcQuerier{paramSource: a.globalfeeSubspace})
135139

136140
m := keeper.NewMigrator(a.globalfeeSubspace)
137141
if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2); err != nil {

0 commit comments

Comments
 (0)