chore: refactor code quality issues (#8932)
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com> Co-authored-by: Alessio Treglia <alessio@tendermint.com> Co-authored-by: Marko <marbar3778@yahoo.com>
This commit is contained in:
parent
5bd93bfe7b
commit
7b1d80e6e4
|
@ -0,0 +1,20 @@
|
|||
version = 1
|
||||
|
||||
test_patterns = [
|
||||
"tests/**",
|
||||
"**_test.go"
|
||||
]
|
||||
|
||||
exclude_patterns = [
|
||||
"third_party/proto/**",
|
||||
"testutil/**",
|
||||
"proto/cosmos/**",
|
||||
"contrib/**"
|
||||
]
|
||||
|
||||
[[analyzers]]
|
||||
name = "go"
|
||||
enabled = true
|
||||
|
||||
[analyzers.meta]
|
||||
import_paths = ["github.com/cosmos/cosmos-sdk"]
|
|
@ -51,7 +51,7 @@ func TestContext_PrintObject(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
require.Equal(t,
|
||||
`{"animal":{"@type":"/testdata.Dog","size":"big","name":"Spot"},"x":"10"}
|
||||
`, string(buf.Bytes()))
|
||||
`, buf.String())
|
||||
|
||||
// yaml
|
||||
buf = &bytes.Buffer{}
|
||||
|
@ -65,7 +65,7 @@ func TestContext_PrintObject(t *testing.T) {
|
|||
name: Spot
|
||||
size: big
|
||||
x: "10"
|
||||
`, string(buf.Bytes()))
|
||||
`, buf.String())
|
||||
|
||||
//
|
||||
// amino
|
||||
|
@ -81,7 +81,7 @@ x: "10"
|
|||
require.NoError(t, err)
|
||||
require.Equal(t,
|
||||
`{"type":"testdata/HasAnimal","value":{"animal":{"type":"testdata/Dog","value":{"size":"big","name":"Spot"}},"x":"10"}}
|
||||
`, string(buf.Bytes()))
|
||||
`, buf.String())
|
||||
|
||||
// yaml
|
||||
buf = &bytes.Buffer{}
|
||||
|
@ -98,7 +98,7 @@ value:
|
|||
name: Spot
|
||||
size: big
|
||||
x: "10"
|
||||
`, string(buf.Bytes()))
|
||||
`, buf.String())
|
||||
}
|
||||
|
||||
func TestCLIQueryConn(t *testing.T) {
|
||||
|
|
|
@ -903,8 +903,7 @@ func generatePubKeysAndSignatures(n int, msg []byte, _ bool) (pubkeys []cryptoty
|
|||
pubkeys = make([]cryptotypes.PubKey, n)
|
||||
signatures = make([][]byte, n)
|
||||
for i := 0; i < n; i++ {
|
||||
var privkey cryptotypes.PrivKey
|
||||
privkey = secp256k1.GenPrivKey()
|
||||
var privkey cryptotypes.PrivKey = secp256k1.GenPrivKey()
|
||||
|
||||
// TODO: also generate ed25519 keys as below when ed25519 keys are
|
||||
// actually supported, https://github.com/cosmos/cosmos-sdk/issues/4789
|
||||
|
|
|
@ -116,7 +116,7 @@ func (s *IntegrationTestSuite) TestEncodeDecode() {
|
|||
err = cdc.UnmarshalJSON(res, &encodeResp)
|
||||
require.NoError(err)
|
||||
|
||||
bz, err = cdc.MarshalJSON(authrest.DecodeReq{Tx: encodeResp.Tx})
|
||||
bz, err = cdc.MarshalJSON(authrest.DecodeReq(encodeResp))
|
||||
require.NoError(err)
|
||||
|
||||
res, err = rest.PostRequest(fmt.Sprintf("%s/txs/decode", val.APIAddress), "application/json", bz)
|
||||
|
|
|
@ -40,8 +40,7 @@ func TestTxBuilder(t *testing.T) {
|
|||
Sequence: accSeq,
|
||||
})
|
||||
|
||||
var sig signing.SignatureV2
|
||||
sig = signing.SignatureV2{
|
||||
var sig signing.SignatureV2 = signing.SignatureV2{
|
||||
PubKey: pubkey,
|
||||
Data: &signing.SingleSignatureData{
|
||||
SignMode: signing.SignMode_SIGN_MODE_DIRECT,
|
||||
|
|
|
@ -90,7 +90,7 @@ func TestStoreMigration(t *testing.T) {
|
|||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
if bytes.Compare(tc.oldKey, tc.newKey) != 0 {
|
||||
if !bytes.Equal(tc.oldKey, tc.newKey) {
|
||||
require.Nil(t, store.Get(tc.oldKey))
|
||||
}
|
||||
require.Equal(t, value, store.Get(tc.newKey))
|
||||
|
|
|
@ -82,7 +82,7 @@ func TestStoreMigration(t *testing.T) {
|
|||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
if bytes.Compare(tc.oldKey, tc.newKey) != 0 {
|
||||
if !bytes.Equal(tc.oldKey, tc.newKey) {
|
||||
require.Nil(t, store.Get(tc.oldKey))
|
||||
}
|
||||
require.Equal(t, tc.newValue, store.Get(tc.newKey))
|
||||
|
|
|
@ -59,7 +59,7 @@ func TestStoreMigration(t *testing.T) {
|
|||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
if bytes.Compare(tc.oldKey, tc.newKey) != 0 {
|
||||
if !bytes.Equal(tc.oldKey, tc.newKey) {
|
||||
require.Nil(t, store.Get(tc.oldKey))
|
||||
}
|
||||
require.Equal(t, value, store.Get(tc.newKey))
|
||||
|
|
|
@ -128,7 +128,7 @@ func TestStoreMigration(t *testing.T) {
|
|||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
if bytes.Compare(tc.oldKey, tc.newKey) != 0 {
|
||||
if !bytes.Equal(tc.oldKey, tc.newKey) {
|
||||
require.Nil(t, store.Get(tc.oldKey))
|
||||
}
|
||||
require.Equal(t, value, store.Get(tc.newKey))
|
||||
|
|
Loading…
Reference in New Issue