Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
tkxkd0159 committed Jun 25, 2024
1 parent 84fed70 commit 449752e
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 18 deletions.
6 changes: 3 additions & 3 deletions x/fbridge/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

const (
flagSequences = "sequences"
FlagSequences = "sequences"
)

// NewQueryCmd returns the query commands for fbridge module
Expand Down Expand Up @@ -100,7 +100,7 @@ func NewQuerySeqToBlocknumsCmd() *cobra.Command {
}
qc := types.NewQueryClient(clientCtx)

seqSlice, err := cmd.Flags().GetInt64Slice(flagSequences)
seqSlice, err := cmd.Flags().GetInt64Slice(FlagSequences)
if err != nil {
return err
}
Expand All @@ -119,7 +119,7 @@ func NewQuerySeqToBlocknumsCmd() *cobra.Command {
},
}

cmd.Flags().Int64Slice(flagSequences, []int64{}, "comma separated list of bridge sequnece numbers")
cmd.Flags().Int64Slice(FlagSequences, []int64{}, "comma separated list of bridge sequnece numbers")
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
Expand Down
4 changes: 2 additions & 2 deletions x/fbridge/client/cli/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func (s *CLITestSuite) TestQuerySeqToBlocknumsCmd() {
return s.baseCtx.WithClient(c)
},
[]string{
fmt.Sprintf("--sequences=1"),
fmt.Sprintf("--%s=1", cli.FlagSequences),
fmt.Sprintf("--%s=json", FlagOutput),
},
&types.QuerySeqToBlocknumsResponse{},
Expand All @@ -148,7 +148,7 @@ func (s *CLITestSuite) TestQuerySeqToBlocknumsCmd() {
})
return s.baseCtx.WithClient(c)
},
[]string{fmt.Sprintf("--sequences=1.3"), fmt.Sprintf("--%s=json", FlagOutput)},
[]string{fmt.Sprintf("--%s=1.3", cli.FlagSequences), fmt.Sprintf("--%s=json", FlagOutput)},
&types.QuerySeqToBlocknumsResponse{},
true,
},
Expand Down
7 changes: 1 addition & 6 deletions x/fbridge/client/cli/tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/gogo/protobuf/proto"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/suite"

abci "github.com/tendermint/tendermint/abci/types"
rpcclientmock "github.com/tendermint/tendermint/rpc/client/mock"

Expand Down Expand Up @@ -82,7 +81,7 @@ func (s *CLITestSuite) SetupSuite() {

func cliArgs(args ...string) []string {
return append(args, []string{
fmt.Sprintf("--output=json"),
fmt.Sprintf("--%s=json", FlagOutput),
fmt.Sprintf("--%s=home", flags.FlagKeyringDir),
fmt.Sprintf("--%s=mynote", flags.FlagNote),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()),
Expand Down Expand Up @@ -165,7 +164,6 @@ func (s *CLITestSuite) TestNewTransferTxCmd() {
}

for _, tc := range tcs {
tc := tc
s.Run(tc.name, func() {
out, err := clitestutil.ExecTestCLICmd(s.clientCtx, cmd, tc.args)
if tc.expectErr {
Expand Down Expand Up @@ -223,7 +221,6 @@ func (s *CLITestSuite) TestNewSuggestRoleTxCmd() {
}

for _, tc := range tcs {
tc := tc
s.Run(tc.name, func() {
out, err := clitestutil.ExecTestCLICmd(s.clientCtx, cmd, tc.args)
if tc.expectErr {
Expand Down Expand Up @@ -301,7 +298,6 @@ func (s *CLITestSuite) TestNewAddVoteForRoleTxCmd() {
}

for _, tc := range tcs {
tc := tc
s.Run(tc.name, func() {
out, err := clitestutil.ExecTestCLICmd(s.clientCtx, cmd, tc.args)
if tc.expectErr {
Expand Down Expand Up @@ -365,7 +361,6 @@ func (s *CLITestSuite) TestNewSetBridgeStatusTxCmd() {
}

for _, tc := range tcs {
tc := tc
s.Run(tc.name, func() {
out, err := clitestutil.ExecTestCLICmd(s.clientCtx, cmd, tc.args)
if tc.expectErr {
Expand Down
6 changes: 3 additions & 3 deletions x/fbridge/keeper/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ func TestAssignRole(t *testing.T) {
require.Error(t, err, "invalid vote option must be rejected")
err = k.addVote(ctx, p.Id, addrs[0], types.OptionYes)
require.NoError(t, err)
opt, err := k.GetVote(ctx, wrongProposalID, addrs[0])
_, err = k.GetVote(ctx, wrongProposalID, addrs[0])
require.Error(t, err, "this proposal must not be found")
opt, err = k.GetVote(ctx, p.Id, addrs[0])
opt, err := k.GetVote(ctx, p.Id, addrs[0])
require.NoError(t, err)
require.Equal(t, types.OptionYes, opt)

Expand All @@ -68,7 +68,7 @@ func TestAssignRole(t *testing.T) {
require.Equal(t, types.RoleMetadata{Guardian: 1, Operator: 1, Judge: 0}, k.GetRoleMetadata(ctx))

// 4. Guardian assigns an address to a same role
p, err = k.RegisterRoleProposal(ctx, addrs[0], addrs[1], types.RoleOperator)
_, err = k.RegisterRoleProposal(ctx, addrs[0], addrs[1], types.RoleOperator)
require.Error(t, err, "the role proposal cannot be submitted if target's role is equal to the role in proposal")
err = k.updateRole(ctx, types.RoleOperator, addrs[1])
require.NoError(t, err)
Expand Down
1 change: 1 addition & 0 deletions x/fbridge/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package keeper_test
import (
"context"
"fmt"

sdk "github.com/Finschia/finschia-sdk/types"
"github.com/Finschia/finschia-sdk/x/fbridge/types"
)
Expand Down
6 changes: 4 additions & 2 deletions x/fbridge/types/fbridge_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package types_test

import (
"github.com/Finschia/finschia-sdk/x/fbridge/types"
"github.com/stretchr/testify/require"
"testing"

"github.com/stretchr/testify/require"

"github.com/Finschia/finschia-sdk/x/fbridge/types"
)

func TestIsValidRole(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion x/fbridge/types/keys_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package types_test

import (
sdk "github.com/Finschia/finschia-sdk/types"
"testing"

"github.com/stretchr/testify/require"

sdk "github.com/Finschia/finschia-sdk/types"
"github.com/Finschia/finschia-sdk/x/fbridge/types"
)

Expand Down
1 change: 0 additions & 1 deletion x/fbridge/types/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ func TestValidateParams(t *testing.T) {
require.NoError(t, p.ValidateParams())
}
})

}
}

Expand Down

0 comments on commit 449752e

Please sign in to comment.