Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
amityadav0 committed Dec 19, 2023
1 parent 3fc211d commit 5a2fb11
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ run:
linters:
enable:
# - bodyclose
- depguard
# - depguard
- dogsled
- dupl
- errcheck
Expand Down
2 changes: 1 addition & 1 deletion x/yield/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

// GetQueryCmd returns the cli query commands for this module
func GetQueryCmd(queryRoute string) *cobra.Command {
func GetQueryCmd(_ string) *cobra.Command {
// Group yield queries under a subcommand
cmd := &cobra.Command{
Use: types.ModuleName,
Expand Down
12 changes: 5 additions & 7 deletions x/yield/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ import (
"github.com/sideprotocol/side/x/yield/types"
)

var (
DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds())
)
var DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds())

const (
flagPacketTimeoutTimestamp = "packet-timeout-timestamp"
listSeparator = ","
)
// const (
// flagPacketTimeoutTimestamp = "packet-timeout-timestamp"
// listSeparator = ","
// )

// GetTxCmd returns the transaction commands for this module
func GetTxCmd() *cobra.Command {
Expand Down
5 changes: 2 additions & 3 deletions x/yield/keeper/host_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,8 @@ func (k Keeper) IterateHostChains(ctx sdk.Context, fn func(ctx sdk.Context, inde
zone := types.HostChain{}
k.cdc.MustUnmarshal(iterator.Value(), &zone)

error := fn(ctx, i, zone)

if error != nil {
err := fn(ctx, i, zone)
if err != nil {
break
}
i++
Expand Down
2 changes: 1 addition & 1 deletion x/yield/keeper/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

// GetParams get all parameters as types.Params
func (k Keeper) GetParams(ctx sdk.Context) types.Params {
func (k Keeper) GetParams(_ sdk.Context) types.Params {
return types.NewParams()
}

Expand Down
9 changes: 6 additions & 3 deletions x/yield/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"

// this line is used by starport scaffolding # 1

"github.com/grpc-ecosystem/grpc-gateway/runtime"
Expand Down Expand Up @@ -54,13 +55,13 @@ func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) {
types.RegisterInterfaces(reg)
}

// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing
// DefaultGenesis returns a default GenesisState for the module, marshaled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing
func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
return cdc.MustMarshalJSON(types.DefaultGenesis())
}

// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error {
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error {
var genState types.GenesisState
if err := cdc.UnmarshalJSON(bz, &genState); err != nil {
return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)
Expand All @@ -70,7 +71,9 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod

// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx))
if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil {
panic(err)
}
}

// GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to generate new transactions containing messages defined in the module
Expand Down
4 changes: 2 additions & 2 deletions x/yield/module_simulation.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var (
)

const (
opWeightMsgRegisterHostChain = "op_weight_msg_register_host_chain"
opWeightMsgRegisterHostChain = "op_weight_msg_register_host_chain" // #nosec
// TODO: Determine the simulation weight value
defaultWeightMsgRegisterHostChain int = 100

Expand Down Expand Up @@ -72,7 +72,7 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp
}

// ProposalMsgs returns msgs used for governance proposals for simulations.
func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg {
func (am AppModule) ProposalMsgs(_ module.SimulationState) []simtypes.WeightedProposalMsg {
return []simtypes.WeightedProposalMsg{
simulation.NewWeightedProposalMsg(
opWeightMsgRegisterHostChain,
Expand Down
6 changes: 3 additions & 3 deletions x/yield/simulation/register_host_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
)

func SimulateMsgRegisterHostChain(
ak types.AccountKeeper,
bk types.BankKeeper,
k keeper.Keeper,
_ types.AccountKeeper,
_ types.BankKeeper,
_ keeper.Keeper,
) simtypes.Operation {
return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
Expand Down
3 changes: 2 additions & 1 deletion x/yield/types/message_register_host_chain.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package types

import (
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
Expand Down Expand Up @@ -51,7 +52,7 @@ func (msg *MsgRegisterHostChain) GetSignBytes() []byte {
func (msg *MsgRegisterHostChain) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
return nil
}

0 comments on commit 5a2fb11

Please sign in to comment.