style: lint the client folder in the repo root (#15816)

This commit is contained in:
Jacob Gadikian 2023-04-13 09:48:48 +07:00 committed by GitHub
parent 1c1af09b17
commit ac3c209326
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 22 additions and 22 deletions

View File

@ -117,7 +117,7 @@ func (ctx Context) BroadcastTxAsync(txBytes []byte) (*sdk.TxResponse, error) {
// TxServiceBroadcast is a helper function to broadcast a Tx with the correct gRPC types
// from the tx service. Calls `clientCtx.BroadcastTx` under the hood.
func TxServiceBroadcast(grpcCtx context.Context, clientCtx Context, req *tx.BroadcastTxRequest) (*tx.BroadcastTxResponse, error) {
func TxServiceBroadcast(_ context.Context, clientCtx Context, req *tx.BroadcastTxRequest) (*tx.BroadcastTxResponse, error) {
if req == nil || req.TxBytes == nil {
return nil, status.Error(codes.InvalidArgument, "invalid empty tx")
}

View File

@ -21,11 +21,11 @@ type MockClient struct {
err error
}
func (c MockClient) BroadcastTxAsync(ctx context.Context, tx cmttypes.Tx) (*coretypes.ResultBroadcastTx, error) {
func (c MockClient) BroadcastTxAsync(_ context.Context, _ cmttypes.Tx) (*coretypes.ResultBroadcastTx, error) {
return nil, c.err
}
func (c MockClient) BroadcastTxSync(ctx context.Context, tx cmttypes.Tx) (*coretypes.ResultBroadcastTx, error) {
func (c MockClient) BroadcastTxSync(_ context.Context, _ cmttypes.Tx) (*coretypes.ResultBroadcastTx, error) {
return nil, c.err
}

View File

@ -32,10 +32,10 @@ func TestContext_PrintProto(t *testing.T) {
Size_: "big",
Name: "Spot",
}
any, err := types.NewAnyWithValue(animal)
anyAnimal, err := types.NewAnyWithValue(animal)
require.NoError(t, err)
hasAnimal := &testdata.HasAnimal{
Animal: any,
Animal: anyAnimal,
X: 10,
}
@ -75,10 +75,10 @@ func TestContext_PrintObjectLegacy(t *testing.T) {
Size_: "big",
Name: "Spot",
}
any, err := types.NewAnyWithValue(animal)
anyAnimal, err := types.NewAnyWithValue(animal)
require.NoError(t, err)
hasAnimal := &testdata.HasAnimal{
Animal: any,
Animal: anyAnimal,
X: 10,
}

View File

@ -183,7 +183,7 @@ func validatorsOutput(ctx context.Context, cctx client.Context, height *int64, p
}
// GetNodeInfo implements ServiceServer.GetNodeInfo
func (s queryServer) GetNodeInfo(ctx context.Context, req *GetNodeInfoRequest) (*GetNodeInfoResponse, error) {
func (s queryServer) GetNodeInfo(ctx context.Context, _ *GetNodeInfoRequest) (*GetNodeInfoResponse, error) {
status, err := getNodeStatus(ctx, s.clientCtx)
if err != nil {
return nil, err
@ -218,7 +218,7 @@ func (s queryServer) GetNodeInfo(ctx context.Context, req *GetNodeInfoRequest) (
return &resp, nil
}
func (s queryServer) ABCIQuery(ctx context.Context, req *ABCIQueryRequest) (*ABCIQueryResponse, error) {
func (s queryServer) ABCIQuery(_ context.Context, req *ABCIQueryRequest) (*ABCIQueryResponse, error) {
if s.queryFn == nil {
return nil, status.Error(codes.Internal, "ABCI Query handler undefined")
}

View File

@ -229,8 +229,8 @@ func runAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *buf
// Get bip39 mnemonic
var mnemonic, bip39Passphrase string
recover, _ := cmd.Flags().GetBool(flagRecover)
if recover {
recoverFlag, _ := cmd.Flags().GetBool(flagRecover)
if recoverFlag {
mnemonic, err = input.GetString("Enter your bip39 mnemonic", inBuf)
if err != nil {
return err
@ -291,7 +291,7 @@ func runAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *buf
}
// Recover key from seed passphrase
if recover {
if recoverFlag {
// Hide mnemonic from output
showMnemonic = false
mnemonic = ""

View File

@ -95,14 +95,14 @@ func (b *AuxTxBuilder) SetSequence(accSeq uint64) {
// SetPubKey sets the aux signer's pubkey in the AuxSignerData.
func (b *AuxTxBuilder) SetPubKey(pk cryptotypes.PubKey) error {
any, err := codectypes.NewAnyWithValue(pk)
anyAnimal, err := codectypes.NewAnyWithValue(pk)
if err != nil {
return err
}
b.checkEmptyFields()
b.auxSignerData.SignDoc.PublicKey = any
b.auxSignerData.SignDoc.PublicKey = anyAnimal
return nil
}

View File

@ -28,7 +28,7 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
)
func newTestTxConfig(t *testing.T) (client.TxConfig, codec.Codec) {
func newTestTxConfig() (client.TxConfig, codec.Codec) {
encodingConfig := moduletestutil.MakeTestEncodingConfig()
return authtx.NewTxConfig(codec.NewProtoCodec(encodingConfig.InterfaceRegistry), authtx.DefaultSignModes), encodingConfig.Codec
}
@ -40,7 +40,7 @@ type mockContext struct {
wantErr bool
}
func (m mockContext) Invoke(grpcCtx context.Context, method string, req, reply interface{}, opts ...grpc.CallOption) (err error) {
func (m mockContext) Invoke(_ context.Context, _ string, _, reply interface{}, _ ...grpc.CallOption) (err error) {
if m.wantErr {
return fmt.Errorf("mock err")
}
@ -77,7 +77,7 @@ func TestCalculateGas(t *testing.T) {
for _, tc := range testCases {
stc := tc
txCfg, _ := newTestTxConfig(t)
txCfg, _ := newTestTxConfig()
txf := tx.Factory{}.
WithChainID("test-chain").
@ -103,7 +103,7 @@ func TestCalculateGas(t *testing.T) {
}
func TestBuildSimTx(t *testing.T) {
txCfg, cdc := newTestTxConfig(t)
txCfg, cdc := newTestTxConfig()
kb, err := keyring.New(t.Name(), "test", t.TempDir(), nil, cdc)
require.NoError(t, err)
@ -129,7 +129,7 @@ func TestBuildSimTx(t *testing.T) {
}
func TestBuildUnsignedTx(t *testing.T) {
txConfig, cdc := newTestTxConfig(t)
txConfig, cdc := newTestTxConfig()
kb, err := keyring.New(t.Name(), "test", t.TempDir(), nil, cdc)
require.NoError(t, err)
@ -158,7 +158,7 @@ func TestBuildUnsignedTx(t *testing.T) {
}
func TestMnemonicInMemo(t *testing.T) {
txConfig, cdc := newTestTxConfig(t)
txConfig, cdc := newTestTxConfig()
kb, err := keyring.New(t.Name(), "test", t.TempDir(), nil, cdc)
require.NoError(t, err)
@ -207,7 +207,7 @@ func TestMnemonicInMemo(t *testing.T) {
}
func TestSign(t *testing.T) {
txConfig, cdc := newTestTxConfig(t)
txConfig, cdc := newTestTxConfig()
requireT := require.New(t)
path := hd.CreateHDPath(118, 0, 0).String()
kb, err := keyring.New(t.Name(), "test", t.TempDir(), nil, cdc)
@ -363,7 +363,7 @@ func TestSign(t *testing.T) {
}
func TestPreprocessHook(t *testing.T) {
txConfig, cdc := newTestTxConfig(t)
txConfig, cdc := newTestTxConfig()
requireT := require.New(t)
path := hd.CreateHDPath(118, 0, 0).String()
kb, err := keyring.New(t.Name(), "test", t.TempDir(), nil, cdc)