From 21675b45744fdc0d4358fd8bcf0f67d0a2ec8423 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Wed, 3 Apr 2024 14:39:59 +0530 Subject: [PATCH] Handle lint errors --- .golangci.yml | 1 - Makefile | 2 +- rpc/websockets.go | 5 ++--- x/auction/keeper/msg_server.go | 6 ++---- x/bond/keeper/msg_server.go | 6 ++---- x/evm/simulation/operations.go | 7 +++---- x/registry/keeper/msg_server.go | 3 --- 7 files changed, 10 insertions(+), 20 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 84dea2d3..d65f510f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -8,7 +8,6 @@ linters: - bodyclose # - depguard # 20231120 disable until https://github.com/golangci/golangci-lint/issues/3906 is released - dogsled - - dupl - errcheck - goconst - gocritic diff --git a/Makefile b/Makefile index 4d9c77e9..dbc5b767 100644 --- a/Makefile +++ b/Makefile @@ -389,7 +389,7 @@ format-fix: ############################################################################### # ------ -# NOTE: Link to the tendermintdev/sdk-proto-gen docker images: +# NOTE: Link to the tendermintdev/sdk-proto-gen docker images: # https://hub.docker.com/r/tendermintdev/sdk-proto-gen/tags # protoVer=v0.7 diff --git a/rpc/websockets.go b/rpc/websockets.go index 179c996d..c98014d7 100644 --- a/rpc/websockets.go +++ b/rpc/websockets.go @@ -94,11 +94,10 @@ func (s *websocketsServer) Start() { go func() { var err error - /* #nosec G114 -- http functions have no support for timeouts */ if s.certFile == "" || s.keyFile == "" { - err = http.ListenAndServe(s.wsAddr, ws) + err = http.ListenAndServe(s.wsAddr, ws) /* #nosec G114 -- http functions have no support for timeouts */ } else { - err = http.ListenAndServeTLS(s.wsAddr, s.certFile, s.keyFile, ws) + err = http.ListenAndServeTLS(s.wsAddr, s.certFile, s.keyFile, ws) // #nosec G114 } if err != nil { diff --git a/x/auction/keeper/msg_server.go b/x/auction/keeper/msg_server.go index e2ef1ae8..c7467974 100644 --- a/x/auction/keeper/msg_server.go +++ b/x/auction/keeper/msg_server.go @@ -55,7 +55,6 @@ func (s msgServer) CreateAuction(c context.Context, msg *types.MsgCreateAuction) } // CommitBid is the command for committing a bid -//nolint: all func (s msgServer) CommitBid(c context.Context, msg *types.MsgCommitBid) (*types.MsgCommitBidResponse, error) { ctx := sdk.UnwrapSDKContext(c) ctx = *utils.CtxWithCustomKVGasConfig(&ctx) @@ -89,7 +88,6 @@ func (s msgServer) CommitBid(c context.Context, msg *types.MsgCommitBid) (*types } // RevealBid is the command for revealing a bid -//nolint: all func (s msgServer) RevealBid(c context.Context, msg *types.MsgRevealBid) (*types.MsgRevealBidResponse, error) { ctx := sdk.UnwrapSDKContext(c) ctx = *utils.CtxWithCustomKVGasConfig(&ctx) @@ -122,7 +120,7 @@ func (s msgServer) RevealBid(c context.Context, msg *types.MsgRevealBid) (*types return &types.MsgRevealBidResponse{Auction: resp}, nil } -func (m msgServer) logTxGasConsumed(ctx sdk.Context, tx string) { +func (s msgServer) logTxGasConsumed(ctx sdk.Context, tx string) { gasConsumed := ctx.GasMeter().GasConsumed() - m.Keeper.Logger(ctx).Info("tx executed", "method", tx, "gas_consumed", fmt.Sprintf("%d", gasConsumed)) + s.Keeper.Logger(ctx).Info("tx executed", "method", tx, "gas_consumed", fmt.Sprintf("%d", gasConsumed)) } diff --git a/x/bond/keeper/msg_server.go b/x/bond/keeper/msg_server.go index 8d33893d..cc462341 100644 --- a/x/bond/keeper/msg_server.go +++ b/x/bond/keeper/msg_server.go @@ -52,7 +52,6 @@ func (k msgServer) CreateBond(c context.Context, msg *types.MsgCreateBond) (*typ return &types.MsgCreateBondResponse{}, nil } -//nolint: all func (k msgServer) RefillBond(c context.Context, msg *types.MsgRefillBond) (*types.MsgRefillBondResponse, error) { ctx := sdk.UnwrapSDKContext(c) ctx = *utils.CtxWithCustomKVGasConfig(&ctx) @@ -86,7 +85,6 @@ func (k msgServer) RefillBond(c context.Context, msg *types.MsgRefillBond) (*typ return &types.MsgRefillBondResponse{}, nil } -//nolint: all func (k msgServer) WithdrawBond(c context.Context, msg *types.MsgWithdrawBond) (*types.MsgWithdrawBondResponse, error) { ctx := sdk.UnwrapSDKContext(c) ctx = *utils.CtxWithCustomKVGasConfig(&ctx) @@ -151,7 +149,7 @@ func (k msgServer) CancelBond(c context.Context, msg *types.MsgCancelBond) (*typ return &types.MsgCancelBondResponse{}, nil } -func (m msgServer) logTxGasConsumed(ctx sdk.Context, tx string) { +func (k msgServer) logTxGasConsumed(ctx sdk.Context, tx string) { gasConsumed := ctx.GasMeter().GasConsumed() - m.Keeper.Logger(ctx).Info("tx executed", "method", tx, "gas_consumed", fmt.Sprintf("%d", gasConsumed)) + k.Keeper.Logger(ctx).Info("tx executed", "method", tx, "gas_consumed", fmt.Sprintf("%d", gasConsumed)) } diff --git a/x/evm/simulation/operations.go b/x/evm/simulation/operations.go index 7f8960ca..e11366d7 100644 --- a/x/evm/simulation/operations.go +++ b/x/evm/simulation/operations.go @@ -32,11 +32,10 @@ import ( "github.com/ethereum/go-ethereum/crypto" ) -// #nosec 101 const ( - OpWeightMsgEthSimpleTransfer = "op_weight_msg_eth_simple_transfer" - OpWeightMsgEthCreateContract = "op_weight_msg_eth_create_contract" - OpWeightMsgEthCallContract = "op_weight_msg_eth_call_contract" + OpWeightMsgEthSimpleTransfer = "op_weight_msg_eth_simple_transfer" // #nosec G101 + OpWeightMsgEthCreateContract = "op_weight_msg_eth_create_contract" // #nosec G101 + OpWeightMsgEthCallContract = "op_weight_msg_eth_call_contract" // #nosec G101 ) const ( diff --git a/x/registry/keeper/msg_server.go b/x/registry/keeper/msg_server.go index 542cae18..b244e654 100644 --- a/x/registry/keeper/msg_server.go +++ b/x/registry/keeper/msg_server.go @@ -54,7 +54,6 @@ func (m msgServer) SetRecord(c context.Context, msg *types.MsgSetRecord) (*types return &types.MsgSetRecordResponse{Id: record.ID}, nil } -//nolint: all func (m msgServer) SetName(c context.Context, msg *types.MsgSetName) (*types.MsgSetNameResponse, error) { ctx := sdk.UnwrapSDKContext(c) ctx = *utils.CtxWithCustomKVGasConfig(&ctx) @@ -121,7 +120,6 @@ func (m msgServer) ReserveName(c context.Context, msg *types.MsgReserveAuthority return &types.MsgReserveAuthorityResponse{}, nil } -//nolint: all func (m msgServer) SetAuthorityBond(c context.Context, msg *types.MsgSetAuthorityBond) (*types.MsgSetAuthorityBondResponse, error) { ctx := sdk.UnwrapSDKContext(c) ctx = *utils.CtxWithCustomKVGasConfig(&ctx) @@ -213,7 +211,6 @@ func (m msgServer) RenewRecord(c context.Context, msg *types.MsgRenewRecord) (*t return &types.MsgRenewRecordResponse{}, nil } -//nolint: all func (m msgServer) AssociateBond(c context.Context, msg *types.MsgAssociateBond) (*types.MsgAssociateBondResponse, error) { ctx := sdk.UnwrapSDKContext(c) ctx = *utils.CtxWithCustomKVGasConfig(&ctx)