Skip to content

Commit

Permalink
Linter only (#1609)
Browse files Browse the repository at this point in the history
* Linter only

* Bump linter version
  • Loading branch information
alpe authored Sep 7, 2023
1 parent 3d9d92c commit 0f82c95
Show file tree
Hide file tree
Showing 14 changed files with 37 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:

lint:
docker:
- image: golangci/golangci-lint:v1.52.2
- image: golangci/golangci-lint:v1.54.2
steps:
- checkout
- run:
Expand Down
3 changes: 1 addition & 2 deletions x/wasm/client/cli/gov_tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ import (
"strings"
"testing"

"github.com/CosmWasm/wasmd/x/wasm/keeper/testdata"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/CosmWasm/wasmd/x/wasm/keeper/testdata"
"github.com/CosmWasm/wasmd/x/wasm/types"
)

Expand Down
3 changes: 1 addition & 2 deletions x/wasm/client/cli/tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ import (
"encoding/hex"
"testing"

"github.com/CosmWasm/wasmd/x/wasm/keeper/testdata"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/CosmWasm/wasmd/x/wasm/ioutils"
"github.com/CosmWasm/wasmd/x/wasm/keeper/testdata"
"github.com/CosmWasm/wasmd/x/wasm/types"
)

Expand Down
2 changes: 1 addition & 1 deletion x/wasm/keeper/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func InitGenesis(ctx sdk.Context, keeper *Keeper, data types.GenesisState) ([]ab
if err != nil {
return nil, errorsmod.Wrapf(err, "address in contract number %d", i)
}
err = keeper.importContract(ctx, contractAddr, &contract.ContractInfo, contract.ContractState, contract.ContractCodeHistory)
err = keeper.importContract(ctx, contractAddr, &contract.ContractInfo, contract.ContractState, contract.ContractCodeHistory) //nolint:gosec
if err != nil {
return nil, errorsmod.Wrapf(err, "contract number %d", i)
}
Expand Down
4 changes: 2 additions & 2 deletions x/wasm/keeper/handler_plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ func TestIBCRawPacketHandler(t *testing.T) {
capturedPacket = nil
// when
h := NewIBCRawPacketHandler(capturePacketsSenderMock, spec.chanKeeper, spec.capKeeper)
evts, data, gotErr := h.DispatchMsg(ctx, RandomAccountAddress(t), ibcPort, wasmvmtypes.CosmosMsg{IBC: &wasmvmtypes.IBCMsg{SendPacket: &spec.srcMsg}})
evts, data, gotErr := h.DispatchMsg(ctx, RandomAccountAddress(t), ibcPort, wasmvmtypes.CosmosMsg{IBC: &wasmvmtypes.IBCMsg{SendPacket: &spec.srcMsg}}) //nolint:gosec
// then
require.True(t, spec.expErr.Is(gotErr), "exp %v but got %#+v", spec.expErr, gotErr)
if spec.expErr != nil {
Expand Down Expand Up @@ -390,7 +390,7 @@ func TestBurnCoinMessageHandlerIntegration(t *testing.T) {
k.wasmVM = &wasmtesting.MockWasmEngine{ExecuteFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) {
return &wasmvmtypes.Response{
Messages: []wasmvmtypes.SubMsg{
{Msg: wasmvmtypes.CosmosMsg{Bank: &wasmvmtypes.BankMsg{Burn: &spec.msg}}, ReplyOn: wasmvmtypes.ReplyNever},
{Msg: wasmvmtypes.CosmosMsg{Bank: &wasmvmtypes.BankMsg{Burn: &spec.msg}}, ReplyOn: wasmvmtypes.ReplyNever}, //nolint:gosec
},
}, 0, nil
}}
Expand Down
5 changes: 2 additions & 3 deletions x/wasm/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import (
"testing"
"time"

"github.com/CosmWasm/wasmd/x/wasm/keeper/testdata"

wasmvm "github.com/CosmWasm/wasmvm"
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
abci "github.com/cometbft/cometbft/abci/types"
Expand All @@ -36,6 +34,7 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types"

"github.com/CosmWasm/wasmd/x/wasm/keeper/testdata"
"github.com/CosmWasm/wasmd/x/wasm/keeper/wasmtesting"
"github.com/CosmWasm/wasmd/x/wasm/types"
)
Expand Down Expand Up @@ -549,7 +548,7 @@ func TestInstantiateWithPermissions(t *testing.T) {
accKeeper, bankKeeper, keeper := keepers.AccountKeeper, keepers.BankKeeper, keepers.ContractKeeper
fundAccounts(t, ctx, accKeeper, bankKeeper, spec.srcActor, deposit)

contractID, _, err := keeper.Create(ctx, myAddr, hackatomWasm, &spec.srcPermission)
contractID, _, err := keeper.Create(ctx, myAddr, hackatomWasm, &spec.srcPermission) //nolint:gosec
require.NoError(t, err)

_, _, err = keepers.ContractKeeper.Instantiate(ctx, contractID, spec.srcActor, nil, initMsgBz, "demo contract 1", nil)
Expand Down
6 changes: 3 additions & 3 deletions x/wasm/keeper/msg_server_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func TestUpdateParams(t *testing.T) {
require.NoError(t, err)

// when
rsp, err := wasmApp.MsgServiceRouter().Handler(&spec.src)(ctx, &spec.src)
rsp, err := wasmApp.MsgServiceRouter().Handler(&spec.src)(ctx, &spec.src) //nolint:gosec
require.NoError(t, err)
var result types.MsgUpdateParamsResponse
require.NoError(t, wasmApp.AppCodec().Unmarshal(rsp.Data, &result))
Expand Down Expand Up @@ -223,7 +223,7 @@ func TestAddCodeUploadParamsAddresses(t *testing.T) {
require.NoError(t, err)

// when
rsp, err := wasmApp.MsgServiceRouter().Handler(&spec.src)(ctx, &spec.src)
rsp, err := wasmApp.MsgServiceRouter().Handler(&spec.src)(ctx, &spec.src) //nolint:gosec
if spec.expErr {
require.Error(t, err)
require.Nil(t, rsp)
Expand Down Expand Up @@ -319,7 +319,7 @@ func TestRemoveCodeUploadParamsAddresses(t *testing.T) {
require.NoError(t, err)

// when
rsp, err := wasmApp.MsgServiceRouter().Handler(&spec.src)(ctx, &spec.src)
rsp, err := wasmApp.MsgServiceRouter().Handler(&spec.src)(ctx, &spec.src) //nolint:gosec
if spec.expErr {
require.Error(t, err)
require.Nil(t, rsp)
Expand Down
3 changes: 1 addition & 2 deletions x/wasm/keeper/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import (
"reflect"
"testing"

"github.com/prometheus/client_golang/prometheus"

wasmvm "github.com/CosmWasm/wasmvm"
"github.com/prometheus/client_golang/prometheus"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

Expand Down
5 changes: 2 additions & 3 deletions x/wasm/keeper/proposal_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import (
"os"
"testing"

"github.com/CosmWasm/wasmd/x/wasm/keeper/testdata"

wasmvm "github.com/CosmWasm/wasmvm"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand All @@ -20,6 +18,7 @@ import (
v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
"github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"

"github.com/CosmWasm/wasmd/x/wasm/keeper/testdata"
"github.com/CosmWasm/wasmd/x/wasm/keeper/wasmtesting"
"github.com/CosmWasm/wasmd/x/wasm/types"
)
Expand Down Expand Up @@ -639,7 +638,7 @@ func TestAdminProposals(t *testing.T) {
},
}

require.NoError(t, wasmKeeper.importContract(ctx, contractAddr, &spec.state, []types.Model{}, entries))
require.NoError(t, wasmKeeper.importContract(ctx, contractAddr, &spec.state, []types.Model{}, entries)) //nolint:gosec

// when
mustSubmitAndExecuteLegacyProposal(t, ctx, spec.srcProposal, otherAddress.String(), keepers)
Expand Down
6 changes: 3 additions & 3 deletions x/wasm/keeper/querier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ func TestQueryContractHistory(t *testing.T) {

// when
q := Querier(keeper)
got, err := q.ContractHistory(sdk.WrapSDKContext(xCtx), &spec.req)
got, err := q.ContractHistory(sdk.WrapSDKContext(xCtx), &spec.req) //nolint:gosec

// then
if spec.expContent == nil {
Expand Down Expand Up @@ -597,7 +597,7 @@ func TestQueryCodeList(t *testing.T) {
}
// when
q := Querier(keeper)
got, err := q.Codes(sdk.WrapSDKContext(xCtx), &spec.req)
got, err := q.Codes(sdk.WrapSDKContext(xCtx), &spec.req) //nolint:gosec

// then
require.NoError(t, err)
Expand Down Expand Up @@ -664,7 +664,7 @@ func TestQueryContractInfo(t *testing.T) {
for name, spec := range specs {
t.Run(name, func(t *testing.T) {
xCtx, _ := ctx.CacheContext()
k.storeContractInfo(xCtx, contractAddr, &spec.stored)
k.storeContractInfo(xCtx, contractAddr, &spec.stored) //nolint:gosec
// when
gotRsp, gotErr := querier.ContractInfo(sdk.WrapSDKContext(xCtx), spec.src)
if spec.expErr {
Expand Down
12 changes: 6 additions & 6 deletions x/wasm/keeper/query_plugin_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ import (
"strings"
"testing"

stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
"github.com/cosmos/gogoproto/proto"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

errorsmod "cosmossdk.io/errors"

wasmvmtypes "github.com/CosmWasm/wasmvm/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/gogoproto/proto"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

"github.com/CosmWasm/wasmd/x/wasm/keeper/testdata"
"github.com/CosmWasm/wasmd/x/wasm/types"
Expand Down Expand Up @@ -506,7 +506,7 @@ func TestDistributionQuery(t *testing.T) {
},
"delegator address - withdrawal addr set": {
setup: func(t *testing.T, ctx sdk.Context) sdk.Context {
keepers.DistKeeper.SetWithdrawAddr(ctx, delegator, otherAddr)
require.NoError(t, keepers.DistKeeper.SetWithdrawAddr(ctx, delegator, otherAddr))
return ctx
},
query: &wasmvmtypes.DistributionQuery{
Expand Down
17 changes: 9 additions & 8 deletions x/wasm/keeper/query_plugins_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,19 @@ import (
"testing"
"time"

errorsmod "cosmossdk.io/errors"
sdkmath "cosmossdk.io/math"

wasmvmtypes "github.com/CosmWasm/wasmvm/types"
dbm "github.com/cometbft/cometbft-db"
"github.com/cometbft/cometbft/libs/log"
"github.com/cometbft/cometbft/libs/rand"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/cosmos/gogoproto/proto"
channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

errorsmod "cosmossdk.io/errors"
sdkmath "cosmossdk.io/math"

"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
Expand All @@ -27,10 +32,6 @@ import (
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/cosmos/gogoproto/proto"
channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/CosmWasm/wasmd/app"
"github.com/CosmWasm/wasmd/x/wasm/keeper"
Expand Down Expand Up @@ -809,7 +810,7 @@ func TestDistributionQuerier(t *testing.T) {
var mock types.DistributionKeeper
q := keeper.DistributionQuerier(mock)

gotBz, gotErr := q(ctx, &spec.q)
gotBz, gotErr := q(ctx, &spec.q) //nolint:gosec
if spec.expErr {
require.Error(t, gotErr)
return
Expand Down
7 changes: 4 additions & 3 deletions x/wasm/keeper/reflect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@ import (
"os"
"testing"

wasmvmtypes "github.com/CosmWasm/wasmvm/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

errorsmod "cosmossdk.io/errors"

wasmvmtypes "github.com/CosmWasm/wasmvm/types"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/CosmWasm/wasmd/x/wasm/keeper/testdata"
"github.com/CosmWasm/wasmd/x/wasm/types"
Expand Down
2 changes: 1 addition & 1 deletion x/wasm/types/proposal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,7 @@ code_ids:
}
for msg, spec := range specs {
t.Run(msg, func(t *testing.T) {
v, err := yaml.Marshal(&spec.src)
v, err := yaml.Marshal(&spec.src) //nolint:gosec
require.NoError(t, err)
assert.Equal(t, spec.exp, string(v))
})
Expand Down

0 comments on commit 0f82c95

Please sign in to comment.