From 51f3e70a12c22c6afc95ed78a342e90fb929674f Mon Sep 17 00:00:00 2001 From: Marko Date: Thu, 30 Mar 2023 15:00:18 +0200 Subject: [PATCH] style: more linting (#15618) --- baseapp/baseapp.go | 4 ++-- client/config/config_test.go | 6 +++--- client/keys/import_test.go | 2 +- client/keys/output.go | 2 +- codec/proto_codec.go | 4 ++-- crypto/codec/amino.go | 2 +- crypto/keys/ed25519/ed25519.go | 16 ++++++++-------- crypto/keys/ed25519/keys.pb.go | 2 +- crypto/keys/secp256k1/secp256k1.go | 16 ++++++++-------- proto/cosmos/crypto/ed25519/keys.proto | 2 +- server/grpc/gogoreflection/serverreflection.go | 8 ++++---- server/grpc/server.go | 2 +- server/start.go | 2 +- testutil/network/util.go | 2 +- tools/cosmovisor/args_test.go | 1 - types/query/collections_pagination.go | 4 ++-- x/auth/ante/setup_test.go | 2 +- x/auth/module.go | 10 ++++------ x/auth/tx/config/config.go | 12 +++++------- x/distribution/keeper/delegation.go | 2 +- x/distribution/simulation/genesis_test.go | 2 -- x/genutil/types/genesis_test.go | 2 +- x/gov/client/utils/query.go | 2 +- x/gov/keeper/msg_server_test.go | 2 +- x/gov/simulation/operations_test.go | 10 +++++----- x/params/keeper/keeper_test.go | 2 +- x/params/module.go | 10 ++++------ x/slashing/keeper/genesis_test.go | 2 +- x/slashing/simulation/decoder_test.go | 1 - x/slashing/simulation/operations.go | 2 +- x/slashing/types/expected_keepers.go | 2 +- x/staking/types/expected_keepers.go | 2 +- x/staking/types/historical_info_test.go | 6 ++---- x/staking/types/validator_test.go | 4 +--- 34 files changed, 68 insertions(+), 82 deletions(-) diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index cba39a8469..073e148470 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -861,7 +861,7 @@ func (app *BaseApp) PrepareProposalVerifyTx(tx sdk.Tx) ([]byte, error) { return nil, err } - _, _, _, _, err = app.runTx(runTxPrepareProposal, bz) //nolint:dogsled + _, _, _, _, err = app.runTx(runTxPrepareProposal, bz) if err != nil { return nil, err } @@ -880,7 +880,7 @@ func (app *BaseApp) ProcessProposalVerifyTx(txBz []byte) (sdk.Tx, error) { return nil, err } - _, _, _, _, err = app.runTx(runTxProcessProposal, txBz) //nolint:dogsled + _, _, _, _, err = app.runTx(runTxProcessProposal, txBz) if err != nil { return nil, err } diff --git a/client/config/config_test.go b/client/config/config_test.go index 64e28ccc3d..c5630f22a3 100644 --- a/client/config/config_test.go +++ b/client/config/config_test.go @@ -24,12 +24,12 @@ const ( // initClientContext initiates client Context for tests func initClientContext(t *testing.T, envVar string) (client.Context, func()) { home := t.TempDir() - chainId := "test-chain" //nolint:revive + chainID := "test-chain" clientCtx := client.Context{}. WithHomeDir(home). WithViper(""). WithCodec(codec.NewProtoCodec(codectypes.NewInterfaceRegistry())). - WithChainID(chainId) + WithChainID(chainID) require.NoError(t, clientCtx.Viper.BindEnv(nodeEnv)) if envVar != "" { @@ -38,7 +38,7 @@ func initClientContext(t *testing.T, envVar string) (client.Context, func()) { clientCtx, err := config.ReadFromClientConfig(clientCtx) require.NoError(t, err) - require.Equal(t, clientCtx.ChainID, chainId) + require.Equal(t, clientCtx.ChainID, chainID) return clientCtx, func() { _ = os.RemoveAll(home) } } diff --git a/client/keys/import_test.go b/client/keys/import_test.go index 59cdf044d9..d9b9d0fee7 100644 --- a/client/keys/import_test.go +++ b/client/keys/import_test.go @@ -94,7 +94,7 @@ HbP+c6JmeJy9JXe2rbbF1QtCX1gLqGcDQPBXiCtFvP7/8wTZtVOPj8vREzhZ9ElO t.Cleanup(cleanupKeys(t, kb, "keyname1")) keyfile := filepath.Join(kbHome, "key.asc") - require.NoError(t, os.WriteFile(keyfile, []byte(armoredKey), 0o644)) //nolint:gosec + require.NoError(t, os.WriteFile(keyfile, []byte(armoredKey), 0o600)) defer func() { _ = os.RemoveAll(kbHome) diff --git a/client/keys/output.go b/client/keys/output.go index 8932334981..1ec5eed6a6 100644 --- a/client/keys/output.go +++ b/client/keys/output.go @@ -21,7 +21,7 @@ type KeyOutput struct { } // NewKeyOutput creates a default KeyOutput instance without Mnemonic, Threshold and PubKeys -func NewKeyOutput(name string, keyType keyring.KeyType, a sdk.Address, pk cryptotypes.PubKey) (KeyOutput, error) { //nolint:interfacer +func NewKeyOutput(name string, keyType keyring.KeyType, a sdk.Address, pk cryptotypes.PubKey) (KeyOutput, error) { apk, err := codectypes.NewAnyWithValue(pk) if err != nil { return KeyOutput{}, err diff --git a/codec/proto_codec.go b/codec/proto_codec.go index ed71b8f897..6d4fec199b 100644 --- a/codec/proto_codec.go +++ b/codec/proto_codec.go @@ -186,7 +186,7 @@ func (pc *ProtoCodec) MustUnmarshalJSON(bz []byte, ptr gogoproto.Message) { } } -// MarshalInterface is a convenience function for proto marshalling interfaces. It packs +// MarshalInterface is a convenience function for proto marshaling interfaces. It packs // the provided value, which must be an interface, in an Any and then marshals it to bytes. // NOTE: to marshal a concrete type, you should use Marshal instead func (pc *ProtoCodec) MarshalInterface(i gogoproto.Message) ([]byte, error) { @@ -224,7 +224,7 @@ func (pc *ProtoCodec) UnmarshalInterface(bz []byte, ptr interface{}) error { return pc.UnpackAny(any, ptr) } -// MarshalInterfaceJSON is a convenience function for proto marshalling interfaces. It +// MarshalInterfaceJSON is a convenience function for proto marshaling interfaces. It // packs the provided value in an Any and then marshals it to bytes. // NOTE: to marshal a concrete type, you should use MarshalJSON instead func (pc *ProtoCodec) MarshalInterfaceJSON(x gogoproto.Message) ([]byte, error) { diff --git a/crypto/codec/amino.go b/crypto/codec/amino.go index 27bb10ce46..988c17ba19 100644 --- a/crypto/codec/amino.go +++ b/crypto/codec/amino.go @@ -26,7 +26,7 @@ func RegisterCrypto(cdc *codec.LegacyAmino) { cdc.RegisterInterface((*cryptotypes.PrivKey)(nil), nil) cdc.RegisterConcrete(sr25519.PrivKey{}, sr25519.PrivKeyName, nil) - cdc.RegisterConcrete(&ed25519.PrivKey{}, //nolint:staticcheck + cdc.RegisterConcrete(&ed25519.PrivKey{}, ed25519.PrivKeyName, nil) cdc.RegisterConcrete(&secp256k1.PrivKey{}, secp256k1.PrivKeyName, nil) diff --git a/crypto/keys/ed25519/ed25519.go b/crypto/keys/ed25519/ed25519.go index 37603f20f4..122be97cb2 100644 --- a/crypto/keys/ed25519/ed25519.go +++ b/crypto/keys/ed25519/ed25519.go @@ -94,12 +94,12 @@ func (privKey *PrivKey) Type() string { return keyType } -// MarshalAmino overrides Amino binary marshalling. +// MarshalAmino overrides Amino binary marshaling. func (privKey PrivKey) MarshalAmino() ([]byte, error) { return privKey.Key, nil } -// UnmarshalAmino overrides Amino binary marshalling. +// UnmarshalAmino overrides Amino binary marshaling. func (privKey *PrivKey) UnmarshalAmino(bz []byte) error { if len(bz) != PrivKeySize { return fmt.Errorf("invalid privkey size") @@ -109,14 +109,14 @@ func (privKey *PrivKey) UnmarshalAmino(bz []byte) error { return nil } -// MarshalAminoJSON overrides Amino JSON marshalling. +// MarshalAminoJSON overrides Amino JSON marshaling. func (privKey PrivKey) MarshalAminoJSON() ([]byte, error) { // When we marshal to Amino JSON, we don't marshal the "key" field itself, // just its contents (i.e. the key bytes). return privKey.MarshalAmino() } -// UnmarshalAminoJSON overrides Amino JSON marshalling. +// UnmarshalAminoJSON overrides Amino JSON marshaling. func (privKey *PrivKey) UnmarshalAminoJSON(bz []byte) error { return privKey.UnmarshalAmino(bz) } @@ -203,12 +203,12 @@ func (pubKey *PubKey) Equals(other cryptotypes.PubKey) bool { return subtle.ConstantTimeCompare(pubKey.Bytes(), other.Bytes()) == 1 } -// MarshalAmino overrides Amino binary marshalling. +// MarshalAmino overrides Amino binary marshaling. func (pubKey PubKey) MarshalAmino() ([]byte, error) { return pubKey.Key, nil } -// UnmarshalAmino overrides Amino binary marshalling. +// UnmarshalAmino overrides Amino binary marshaling. func (pubKey *PubKey) UnmarshalAmino(bz []byte) error { if len(bz) != PubKeySize { return errorsmod.Wrap(errors.ErrInvalidPubKey, "invalid pubkey size") @@ -218,14 +218,14 @@ func (pubKey *PubKey) UnmarshalAmino(bz []byte) error { return nil } -// MarshalAminoJSON overrides Amino JSON marshalling. +// MarshalAminoJSON overrides Amino JSON marshaling. func (pubKey PubKey) MarshalAminoJSON() ([]byte, error) { // When we marshal to Amino JSON, we don't marshal the "key" field itself, // just its contents (i.e. the key bytes). return pubKey.MarshalAmino() } -// UnmarshalAminoJSON overrides Amino JSON marshalling. +// UnmarshalAminoJSON overrides Amino JSON marshaling. func (pubKey *PubKey) UnmarshalAminoJSON(bz []byte) error { return pubKey.UnmarshalAmino(bz) } diff --git a/crypto/keys/ed25519/keys.pb.go b/crypto/keys/ed25519/keys.pb.go index 1280647df3..e24a1b3b35 100644 --- a/crypto/keys/ed25519/keys.pb.go +++ b/crypto/keys/ed25519/keys.pb.go @@ -73,7 +73,7 @@ func (m *PubKey) GetKey() crypto_ed25519.PublicKey { return nil } -// Deprecated: PrivKey defines a ed25519 private key. +// PrivKey defines a ed25519 private key. // NOTE: ed25519 keys must not be used in SDK apps except in a tendermint validator context. type PrivKey struct { Key crypto_ed25519.PrivateKey `protobuf:"bytes,1,opt,name=key,proto3,casttype=crypto/ed25519.PrivateKey" json:"key,omitempty"` diff --git a/crypto/keys/secp256k1/secp256k1.go b/crypto/keys/secp256k1/secp256k1.go index 68208f859a..380f16420d 100644 --- a/crypto/keys/secp256k1/secp256k1.go +++ b/crypto/keys/secp256k1/secp256k1.go @@ -53,12 +53,12 @@ func (privKey *PrivKey) Type() string { return keyType } -// MarshalAmino overrides Amino binary marshalling. +// MarshalAmino overrides Amino binary marshaling. func (privKey PrivKey) MarshalAmino() ([]byte, error) { return privKey.Key, nil } -// UnmarshalAmino overrides Amino binary marshalling. +// UnmarshalAmino overrides Amino binary marshaling. func (privKey *PrivKey) UnmarshalAmino(bz []byte) error { if len(bz) != PrivKeySize { return fmt.Errorf("invalid privkey size") @@ -68,14 +68,14 @@ func (privKey *PrivKey) UnmarshalAmino(bz []byte) error { return nil } -// MarshalAminoJSON overrides Amino JSON marshalling. +// MarshalAminoJSON overrides Amino JSON marshaling. func (privKey PrivKey) MarshalAminoJSON() ([]byte, error) { // When we marshal to Amino JSON, we don't marshal the "key" field itself, // just its contents (i.e. the key bytes). return privKey.MarshalAmino() } -// UnmarshalAminoJSON overrides Amino JSON marshalling. +// UnmarshalAminoJSON overrides Amino JSON marshaling. func (privKey *PrivKey) UnmarshalAminoJSON(bz []byte) error { return privKey.UnmarshalAmino(bz) } @@ -179,12 +179,12 @@ func (pubKey *PubKey) Equals(other cryptotypes.PubKey) bool { return pubKey.Type() == other.Type() && bytes.Equal(pubKey.Bytes(), other.Bytes()) } -// MarshalAmino overrides Amino binary marshalling. +// MarshalAmino overrides Amino binary marshaling. func (pubKey PubKey) MarshalAmino() ([]byte, error) { return pubKey.Key, nil } -// UnmarshalAmino overrides Amino binary marshalling. +// UnmarshalAmino overrides Amino binary marshaling. func (pubKey *PubKey) UnmarshalAmino(bz []byte) error { if len(bz) != PubKeySize { return errorsmod.Wrap(errors.ErrInvalidPubKey, "invalid pubkey size") @@ -194,14 +194,14 @@ func (pubKey *PubKey) UnmarshalAmino(bz []byte) error { return nil } -// MarshalAminoJSON overrides Amino JSON marshalling. +// MarshalAminoJSON overrides Amino JSON marshaling. func (pubKey PubKey) MarshalAminoJSON() ([]byte, error) { // When we marshal to Amino JSON, we don't marshal the "key" field itself, // just its contents (i.e. the key bytes). return pubKey.MarshalAmino() } -// UnmarshalAminoJSON overrides Amino JSON marshalling. +// UnmarshalAminoJSON overrides Amino JSON marshaling. func (pubKey *PubKey) UnmarshalAminoJSON(bz []byte) error { return pubKey.UnmarshalAmino(bz) } diff --git a/proto/cosmos/crypto/ed25519/keys.proto b/proto/cosmos/crypto/ed25519/keys.proto index 728b54839e..31768075a2 100644 --- a/proto/cosmos/crypto/ed25519/keys.proto +++ b/proto/cosmos/crypto/ed25519/keys.proto @@ -29,7 +29,7 @@ message PubKey { bytes key = 1 [(gogoproto.casttype) = "crypto/ed25519.PublicKey"]; } -// Deprecated: PrivKey defines a ed25519 private key. +// PrivKey defines a ed25519 private key. // NOTE: ed25519 keys must not be used in SDK apps except in a tendermint validator context. message PrivKey { option (amino.name) = "tendermint/PrivKeyEd25519"; diff --git a/server/grpc/gogoreflection/serverreflection.go b/server/grpc/gogoreflection/serverreflection.go index ac1e3c2d05..a7be3e4690 100644 --- a/server/grpc/gogoreflection/serverreflection.go +++ b/server/grpc/gogoreflection/serverreflection.go @@ -290,8 +290,8 @@ func fileDescWithDependencies(fd *dpb.FileDescriptorProto, sentFileDescriptors m } // fileDescEncodingByFilename finds the file descriptor for given filename, -// finds all of its previously unsent transitive dependencies, does marshalling -// on them, and returns the marshalled result. +// finds all of its previously unsent transitive dependencies, does marshaling +// on them, and returns the marshaled result. func (s *serverReflectionServer) fileDescEncodingByFilename(name string, sentFileDescriptors map[string]bool) ([][]byte, error) { enc := getFileDescriptor(name) if enc == nil { @@ -324,7 +324,7 @@ func parseMetadata(meta interface{}) ([]byte, bool) { // fileDescEncodingContainingSymbol finds the file descriptor containing the // given symbol, finds all of its previously unsent transitive dependencies, -// does marshalling on them, and returns the marshalled result. The given symbol +// does marshaling on them, and returns the marshaled result. The given symbol // can be a type, a service or a method. func (s *serverReflectionServer) fileDescEncodingContainingSymbol(name string, sentFileDescriptors map[string]bool) ([][]byte, error) { _, symbols := s.getSymbols() @@ -349,7 +349,7 @@ func (s *serverReflectionServer) fileDescEncodingContainingSymbol(name string, s // fileDescEncodingContainingExtension finds the file descriptor containing // given extension, finds all of its previously unsent transitive dependencies, -// does marshalling on them, and returns the marshalled result. +// does marshaling on them, and returns the marshaled result. func (s *serverReflectionServer) fileDescEncodingContainingExtension(typeName string, extNum int32, sentFileDescriptors map[string]bool) ([][]byte, error) { st, err := typeForName(typeName) if err != nil { diff --git a/server/grpc/server.go b/server/grpc/server.go index 4c809e8655..d133fe451f 100644 --- a/server/grpc/server.go +++ b/server/grpc/server.go @@ -91,7 +91,7 @@ func StartGRPCServer(ctx context.Context, logger log.Logger, cfg config.GRPCConf // the server failed to start properly. select { case <-ctx.Done(): - // The calling process cancelled or closed the provided context, so we must + // The calling process canceled or closed the provided context, so we must // gracefully stop the gRPC server. logger.Info("stopping gRPC server...", "address", cfg.Address) grpcSrv.GracefulStop() diff --git a/server/start.go b/server/start.go index 5469c1923c..32ea3f08d7 100644 --- a/server/start.go +++ b/server/start.go @@ -244,7 +244,7 @@ func startStandAlone(svrCtx *Context, appCreator types.AppCreator) error { return err } - // Wait for the calling process to be cancelled or close the provided context, + // Wait for the calling process to be canceled or close the provided context, // so we can gracefully stop the ABCI server. <-ctx.Done() svrCtx.Logger.Info("stopping the ABCI server...") diff --git a/testutil/network/util.go b/testutil/network/util.go index be118ef951..6b049bfe23 100644 --- a/testutil/network/util.go +++ b/testutil/network/util.go @@ -203,7 +203,7 @@ func writeFile(name, dir string, contents []byte) error { return fmt.Errorf("could not create directory %q: %w", dir, err) } - if err := os.WriteFile(file, contents, 0o644); err != nil { //nolint: gosec + if err := os.WriteFile(file, contents, 0o600); err != nil { return err } diff --git a/tools/cosmovisor/args_test.go b/tools/cosmovisor/args_test.go index 80e0cc54df..4651c387af 100644 --- a/tools/cosmovisor/args_test.go +++ b/tools/cosmovisor/args_test.go @@ -616,7 +616,6 @@ func (s *argsTestSuite) TestGetConfigFromEnv() { } assert.Equal(t, tc.expectedErrCount, errCount, "error count") } - assert.Equal(t, tc.expectedCfg, cfg, "config") }) } diff --git a/types/query/collections_pagination.go b/types/query/collections_pagination.go index 065564e3e3..ae18193320 100644 --- a/types/query/collections_pagination.go +++ b/types/query/collections_pagination.go @@ -26,7 +26,7 @@ type Collection[K, V any] interface { KeyCodec() collcodec.KeyCodec[K] } -// CollectionPaginate follows the same behaviour as Paginate but works on a Collection. +// CollectionPaginate follows the same behavior as Paginate but works on a Collection. func CollectionPaginate[K, V any, C Collection[K, V]]( ctx context.Context, coll C, @@ -87,7 +87,7 @@ func CollectionFilteredPaginate[K, V any, C Collection[K, V]]( } else { results, pageRes, err = collFilteredPaginateNoKey(ctx, coll, prefix, reverse, offset, limit, countTotal, predicateFunc) } - // invalid iter error is ignored to retain Paginate behaviour + // invalid iter error is ignored to retain Paginate behavior if errors.Is(err, collections.ErrInvalidIterator) { return results, pageRes, nil } diff --git a/x/auth/ante/setup_test.go b/x/auth/ante/setup_test.go index a8644c46ba..67c408218a 100644 --- a/x/auth/ante/setup_test.go +++ b/x/auth/ante/setup_test.go @@ -82,7 +82,7 @@ func TestRecoverPanic(t *testing.T) { require.Equal(t, gasLimit, newCtx.GasMeter().Limit()) antehandler = sdk.ChainAnteDecorators(sud, PanicDecorator{}) - require.Panics(t, func() { antehandler(suite.ctx, tx, false) }, "Recovered from non-Out-of-Gas panic") //nolint:errcheck + require.Panics(t, func() { antehandler(suite.ctx, tx, false) }, "Recovered from non-Out-of-Gas panic") } type OutOfGasDecorator struct{} diff --git a/x/auth/module.go b/x/auth/module.go index 4c0703b2b0..00bbb26070 100644 --- a/x/auth/module.go +++ b/x/auth/module.go @@ -210,8 +210,7 @@ func ProvideAddressCodec(config *modulev1.Module) address.Codec { return codecaddress.NewBech32Codec(config.Bech32Prefix) } -//nolint:revive -type AuthInputs struct { +type ModuleInputs struct { depinject.In Config *modulev1.Module @@ -225,15 +224,14 @@ type AuthInputs struct { LegacySubspace exported.Subspace `optional:"true"` } -//nolint:revive -type AuthOutputs struct { +type ModuleOutputs struct { depinject.Out AccountKeeper keeper.AccountKeeper Module appmodule.AppModule } -func ProvideModule(in AuthInputs) AuthOutputs { +func ProvideModule(in ModuleInputs) ModuleOutputs { maccPerms := map[string][]string{} for _, permission := range in.Config.ModuleAccountPermissions { maccPerms[permission.Account] = permission.Permissions @@ -256,5 +254,5 @@ func ProvideModule(in AuthInputs) AuthOutputs { k := keeper.NewAccountKeeper(in.Cdc, in.StoreService, in.AccountI, maccPerms, in.Config.Bech32Prefix, authority.String()) m := NewAppModule(in.Cdc, k, in.RandomGenesisAccountsFn, in.LegacySubspace) - return AuthOutputs{AccountKeeper: k, Module: m} + return ModuleOutputs{AccountKeeper: k, Module: m} } diff --git a/x/auth/tx/config/config.go b/x/auth/tx/config/config.go index 346c9d0eeb..dbfa624e04 100644 --- a/x/auth/tx/config/config.go +++ b/x/auth/tx/config/config.go @@ -24,8 +24,7 @@ func init() { ) } -//nolint:revive -type TxInputs struct { +type ModuleInputs struct { depinject.In Config *txconfigv1.Config @@ -41,15 +40,14 @@ type TxInputs struct { CustomSignModeHandlers func() []signing.SignModeHandler `optional:"true"` } -//nolint:revive -type TxOutputs struct { +type ModuleOutputs struct { depinject.Out TxConfig client.TxConfig BaseAppOption runtime.BaseAppOption } -func ProvideModule(in TxInputs) TxOutputs { +func ProvideModule(in ModuleInputs) ModuleOutputs { textual, err := NewTextualWithBankKeeper(in.TxBankKeeper) if err != nil { panic(err) @@ -100,10 +98,10 @@ func ProvideModule(in TxInputs) TxOutputs { app.SetTxEncoder(txConfig.TxEncoder()) } - return TxOutputs{TxConfig: txConfig, BaseAppOption: baseAppOption} + return ModuleOutputs{TxConfig: txConfig, BaseAppOption: baseAppOption} } -func newAnteHandler(txConfig client.TxConfig, in TxInputs) (sdk.AnteHandler, error) { +func newAnteHandler(txConfig client.TxConfig, in ModuleInputs) (sdk.AnteHandler, error) { if in.BankKeeper == nil { return nil, fmt.Errorf("both AccountKeeper and BankKeeper are required") } diff --git a/x/distribution/keeper/delegation.go b/x/distribution/keeper/delegation.go index 3eb9f2b03c..f840171f3c 100644 --- a/x/distribution/keeper/delegation.go +++ b/x/distribution/keeper/delegation.go @@ -121,7 +121,7 @@ func (k Keeper) CalculateDelegationRewards(ctx sdk.Context, val stakingtypes.Val // // A small amount of this error is tolerated and corrected for, // however any greater amount should be considered a breach in expected - // behaviour. + // behavior. marginOfErr := sdk.SmallestDec().MulInt64(3) if stake.LTE(currentStake.Add(marginOfErr)) { stake = currentStake diff --git a/x/distribution/simulation/genesis_test.go b/x/distribution/simulation/genesis_test.go index 14d4a06780..2af0330439 100644 --- a/x/distribution/simulation/genesis_test.go +++ b/x/distribution/simulation/genesis_test.go @@ -42,8 +42,6 @@ func TestRandomizedGenState(t *testing.T) { dec1, _ := sdk.NewDecFromStr("0.210000000000000000") - require.Equal(t, sdk.ZeroDec(), distrGenesis.Params.BaseProposerReward) //nolint:staticcheck - require.Equal(t, sdk.ZeroDec(), distrGenesis.Params.BonusProposerReward) //nolint:staticcheck require.Equal(t, dec1, distrGenesis.Params.CommunityTax) require.Equal(t, true, distrGenesis.Params.WithdrawAddrEnabled) require.Len(t, distrGenesis.DelegatorStartingInfos, 0) diff --git a/x/genutil/types/genesis_test.go b/x/genutil/types/genesis_test.go index 811c285cee..2455688557 100644 --- a/x/genutil/types/genesis_test.go +++ b/x/genutil/types/genesis_test.go @@ -62,7 +62,7 @@ func TestAppGenesis_ValidGenesis(t *testing.T) { assert.NilError(t, err) assert.DeepEqual(t, appGenesis.Consensus.Params, genesis.Consensus.Params) - // validate marshalling of app genesis + // validate marshaling of app genesis rawAppGenesis, err = json.Marshal(&appGenesis) assert.NilError(t, err) golden.Assert(t, string(rawAppGenesis), "app_genesis.json") diff --git a/x/gov/client/utils/query.go b/x/gov/client/utils/query.go index 8bbd30220e..6ee7ca4a65 100644 --- a/x/gov/client/utils/query.go +++ b/x/gov/client/utils/query.go @@ -35,7 +35,7 @@ func (p Proposer) String() string { // QueryVotesByTxQuery will query for votes via a direct txs tags query. It // will fetch and build votes directly from the returned txs and returns a JSON -// marshalled result or any error that occurred. +// marshaled result or any error that occurred. func QueryVotesByTxQuery(clientCtx client.Context, params v1.QueryProposalVotesParams) ([]byte, error) { var ( votes []*v1.Vote diff --git a/x/gov/keeper/msg_server_test.go b/x/gov/keeper/msg_server_test.go index 8dfe414def..599b559cd1 100644 --- a/x/gov/keeper/msg_server_test.go +++ b/x/gov/keeper/msg_server_test.go @@ -976,7 +976,7 @@ func (suite *KeeperTestSuite) TestMsgUpdateParams() { name: "negative quorum", input: func() *v1.MsgUpdateParams { params1 := params - params1.Quorum = "-0.1" //nolint:goconst + params1.Quorum = "-0.1" return &v1.MsgUpdateParams{ Authority: authority, diff --git a/x/gov/simulation/operations_test.go b/x/gov/simulation/operations_test.go index 6293d9815e..d0b85dfdc7 100644 --- a/x/gov/simulation/operations_test.go +++ b/x/gov/simulation/operations_test.go @@ -37,7 +37,7 @@ import ( var ( _ simtypes.WeightedProposalMsg = MockWeightedProposals{} - _ simtypes.WeightedProposalContent = MockWeightedProposals{} //nolint:staticcheck + _ simtypes.WeightedProposalContent = MockWeightedProposals{} //nolint:staticcheck // testing legacy code path ) type MockWeightedProposals struct { @@ -58,8 +58,8 @@ func (m MockWeightedProposals) MsgSimulatorFn() simtypes.MsgSimulatorFn { } } -func (m MockWeightedProposals) ContentSimulatorFn() simtypes.ContentSimulatorFn { //nolint:staticcheck - return func(r *rand.Rand, _ sdk.Context, _ []simtypes.Account) simtypes.Content { //nolint:staticcheck +func (m MockWeightedProposals) ContentSimulatorFn() simtypes.ContentSimulatorFn { //nolint:staticcheck // testing legacy code path + return func(r *rand.Rand, _ sdk.Context, _ []simtypes.Account) simtypes.Content { //nolint:staticcheck // testing legacy code path return v1beta1.NewTextProposal( fmt.Sprintf("title-%d: %s", m.n, simtypes.RandStringOfLength(r, 100)), fmt.Sprintf("description-%d: %s", m.n, simtypes.RandStringOfLength(r, 4000)), @@ -75,8 +75,8 @@ func mockWeightedProposalMsg(n int) []simtypes.WeightedProposalMsg { return wpc } -func mockWeightedLegacyProposalContent(n int) []simtypes.WeightedProposalContent { //nolint:staticcheck - wpc := make([]simtypes.WeightedProposalContent, n) //nolint:staticcheck +func mockWeightedLegacyProposalContent(n int) []simtypes.WeightedProposalContent { //nolint:staticcheck // testing legacy code path + wpc := make([]simtypes.WeightedProposalContent, n) //nolint:staticcheck // testing legacy code path for i := 0; i < n; i++ { wpc[i] = MockWeightedProposals{i} } diff --git a/x/params/keeper/keeper_test.go b/x/params/keeper/keeper_test.go index e9863c7c5e..1b0a655e0e 100644 --- a/x/params/keeper/keeper_test.go +++ b/x/params/keeper/keeper_test.go @@ -153,7 +153,7 @@ func indirect(ptr interface{}) interface{} { } func TestGetSubspaces(t *testing.T) { - _, _, _, _, keeper := testComponents() //nolint:dogsled + _, _, _, _, keeper := testComponents() table := types.NewKeyTable( types.NewParamSetPair([]byte("string"), "", validateNoOp), diff --git a/x/params/module.go b/x/params/module.go index 867a8735aa..5f312dd5cc 100644 --- a/x/params/module.go +++ b/x/params/module.go @@ -120,8 +120,7 @@ func init() { )) } -//nolint:revive -type ParamsInputs struct { +type ModuleInputs struct { depinject.In KvStoreKey *store.KVStoreKey @@ -130,8 +129,7 @@ type ParamsInputs struct { LegacyAmino *codec.LegacyAmino } -//nolint:revive -type ParamsOutputs struct { +type ModuleOutputs struct { depinject.Out ParamsKeeper keeper.Keeper @@ -139,13 +137,13 @@ type ParamsOutputs struct { GovHandler govv1beta1.HandlerRoute } -func ProvideModule(in ParamsInputs) ParamsOutputs { +func ProvideModule(in ModuleInputs) ModuleOutputs { k := keeper.NewKeeper(in.Cdc, in.LegacyAmino, in.KvStoreKey, in.TransientStoreKey) m := NewAppModule(k) govHandler := govv1beta1.HandlerRoute{RouteKey: proposal.RouterKey, Handler: NewParamChangeProposalHandler(k)} - return ParamsOutputs{ParamsKeeper: k, Module: m, GovHandler: govHandler} + return ModuleOutputs{ParamsKeeper: k, Module: m, GovHandler: govHandler} } type SubspaceInputs struct { diff --git a/x/slashing/keeper/genesis_test.go b/x/slashing/keeper/genesis_test.go index a05d501e93..3db4d79b58 100644 --- a/x/slashing/keeper/genesis_test.go +++ b/x/slashing/keeper/genesis_test.go @@ -42,7 +42,7 @@ func (s *KeeperTestSuite) TestExportAndInitGenesis() { newInfo1, _ := keeper.GetValidatorSigningInfo(ctx, consAddr1) require.NotEqual(info1, newInfo1) - // Initialise genesis with genesis state before tombstone + // Initialize genesis with genesis state before tombstone s.stakingKeeper.EXPECT().IterateValidators(ctx, gomock.Any()).Return() keeper.InitGenesis(ctx, s.stakingKeeper, genesisState) diff --git a/x/slashing/simulation/decoder_test.go b/x/slashing/simulation/decoder_test.go index 974defe4a2..599814c44c 100644 --- a/x/slashing/simulation/decoder_test.go +++ b/x/slashing/simulation/decoder_test.go @@ -17,7 +17,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/slashing/types" ) -//nolint:deadcode,varcheck var ( delPk1 = ed25519.GenPrivKey().PubKey() delAddr1 = sdk.AccAddress(delPk1.Address()) diff --git a/x/slashing/simulation/operations.go b/x/slashing/simulation/operations.go index 41649e2793..9937665aaf 100644 --- a/x/slashing/simulation/operations.go +++ b/x/slashing/simulation/operations.go @@ -19,7 +19,7 @@ import ( // Simulation operation weights constants const ( - OpWeightMsgUnjail = "op_weight_msg_unjail" //nolint:gosec + OpWeightMsgUnjail = "op_weight_msg_unjail" DefaultWeightMsgUnjail = 100 ) diff --git a/x/slashing/types/expected_keepers.go b/x/slashing/types/expected_keepers.go index 22ebcd046b..ba7a34c58a 100644 --- a/x/slashing/types/expected_keepers.go +++ b/x/slashing/types/expected_keepers.go @@ -42,7 +42,7 @@ type StakingKeeper interface { Validator(sdk.Context, sdk.ValAddress) stakingtypes.ValidatorI // get a particular validator by operator address ValidatorByConsAddr(sdk.Context, sdk.ConsAddress) stakingtypes.ValidatorI // get a particular validator by consensus address - // slash the validator and delegators of the validator, specifying offense height, offence power, and slash fraction + // slash the validator and delegators of the validator, specifying offense height, offense power, and slash fraction Slash(sdk.Context, sdk.ConsAddress, int64, int64, sdk.Dec) math.Int SlashWithInfractionReason(sdk.Context, sdk.ConsAddress, int64, int64, sdk.Dec, stakingtypes.Infraction) math.Int Jail(sdk.Context, sdk.ConsAddress) // jail a validator diff --git a/x/staking/types/expected_keepers.go b/x/staking/types/expected_keepers.go index 771fd8ff53..12c43cc800 100644 --- a/x/staking/types/expected_keepers.go +++ b/x/staking/types/expected_keepers.go @@ -61,7 +61,7 @@ type ValidatorSet interface { TotalBondedTokens(sdk.Context) math.Int // total bonded tokens within the validator set StakingTokenSupply(sdk.Context) math.Int // total staking token supply - // slash the validator and delegators of the validator, specifying offense height, offence power, and slash fraction + // slash the validator and delegators of the validator, specifying offense height, offense power, and slash fraction Slash(sdk.Context, sdk.ConsAddress, int64, int64, sdk.Dec) math.Int SlashWithInfractionReason(sdk.Context, sdk.ConsAddress, int64, int64, sdk.Dec, Infraction) math.Int Jail(sdk.Context, sdk.ConsAddress) // jail a validator diff --git a/x/staking/types/historical_info_test.go b/x/staking/types/historical_info_test.go index f463111d77..90b4872733 100644 --- a/x/staking/types/historical_info_test.go +++ b/x/staking/types/historical_info_test.go @@ -37,7 +37,7 @@ func TestHistoricalInfo(t *testing.T) { require.NotPanics(t, func() { value = legacy.Cdc.MustMarshal(&hi) }) - require.NotNil(t, value, "Marshalled HistoricalInfo is nil") + require.NotNil(t, value, "Marshaled HistoricalInfo is nil") recv, err := types.UnmarshalHistoricalInfo(codec.NewAminoCodec(legacy.Cdc), value) require.Nil(t, err, "Unmarshalling HistoricalInfo failed") @@ -59,9 +59,7 @@ func TestValidateBasic(t *testing.T) { // Ensure validators are not sorted for sort.IsSorted(types.Validators(validators)) { rand.Shuffle(len(validators), func(i, j int) { - it := validators[i] //nolint:gocritic - validators[i] = validators[j] - validators[j] = it + validators[i], validators[j] = validators[j], validators[i] }) } hi = types.HistoricalInfo{ diff --git a/x/staking/types/validator_test.go b/x/staking/types/validator_test.go index 6a005cce76..1150fbed61 100644 --- a/x/staking/types/validator_test.go +++ b/x/staking/types/validator_test.go @@ -261,9 +261,7 @@ func TestValidatorsSortDeterminism(t *testing.T) { // Randomly shuffle validators, sort, and check it is equal to original sort for i := 0; i < 10; i++ { rand.Shuffle(10, func(i, j int) { - it := vals[i] //nolint:gocritic - vals[i] = vals[j] - vals[j] = it + vals[i], vals[j] = vals[j], vals[i] }) types.Validators(vals).Sort()