linter: enable nolintlint (#6162)

* nolintlint enable

* remove space

* fix tests

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Marko 2020-05-08 10:46:12 +02:00 committed by GitHub
parent 4e328d75db
commit bef3689245
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
49 changed files with 41 additions and 105 deletions

View File

@ -35,7 +35,7 @@ linters:
- unparam
- misspell
# - wsl
# - nolintlint
- nolintlint
issues:
exclude-rules:

View File

@ -13,7 +13,6 @@ import (
"github.com/cosmos/cosmos-sdk/crypto/keyring"
)
// nolint
const (
// DefaultGasAdjustment is applied to gas estimates to avoid tx execution
// failures due to state changes that might occur between the tx simulation

View File

@ -63,7 +63,6 @@ func NewFactoryFromCLI(input io.Reader) Factory {
return f
}
// nolint
func (f Factory) AccountNumber() uint64 { return f.accountNumber }
func (f Factory) Sequence() uint64 { return f.sequence }
func (f Factory) Gas() uint64 { return f.gas }

View File

@ -424,7 +424,7 @@ func (ks keystore) List() ([]Info, error) {
var res []Info
keys, err := ks.db.Keys()
if err != nil { //nolint:unparam
if err != nil {
return nil, err
}
@ -527,7 +527,7 @@ func SignWithLedger(info Info, msg []byte) (sig []byte, pub tmcrypto.PubKey, err
return nil, nil, errors.New("not a ledger object")
}
path, err := info.GetPath() //nolint:unparam
path, err := info.GetPath()
if err != nil {
return
}
@ -629,7 +629,7 @@ func newRealPrompt(dir string, buf io.Reader) func(string) (string, error) {
buf := bufio.NewReader(buf)
pass, err := input.GetPassword("Enter keyring passphrase:", buf)
if err != nil { //nolint:unparam
if err != nil {
fmt.Fprintln(os.Stderr, err)
continue
}
@ -656,7 +656,7 @@ func newRealPrompt(dir string, buf io.Reader) func(string) (string, error) {
saltBytes := tmcrypto.CRandBytes(16)
passwordHash, err := bcrypt.GenerateFromPassword(saltBytes, []byte(pass), 2)
if err != nil { //nolint:unparam
if err != nil {
fmt.Fprintln(os.Stderr, err)
continue
}

View File

@ -42,7 +42,6 @@ func (msg MsgSubmitProposal) ValidateBasic() error {
return nil
}
// nolint
func (msg *MsgSubmitProposal) GetContent() gov.Content { return msg.Content.GetContent() }
func (msg *MsgSubmitProposal) SetContent(content gov.Content) error {
stdContent := &Content{}

View File

@ -48,6 +48,5 @@ func (s Store) CacheWrapWithTrace(w io.Writer, tc types.TraceContext) types.Cach
// Commit performs a no-op as entries are persistent between commitments.
func (s *Store) Commit() (id types.CommitID) { return }
// nolint
func (s *Store) SetPruning(pruning types.PruningOptions) {}
func (s Store) LastCommitID() (id types.CommitID) { return }

View File

@ -5,7 +5,6 @@ import (
)
// Import cosmos-sdk/types/store.go for convenience.
// nolint
type (
PruningOptions = types.PruningOptions
Store = types.Store
@ -22,8 +21,8 @@ type (
CacheWrapper = types.CacheWrapper
CacheWrap = types.CacheWrap
CommitID = types.CommitID
StoreKey = types.StoreKey
StoreType = types.StoreType
Key = types.StoreKey
Type = types.StoreType
Queryable = types.Queryable
TraceContext = types.TraceContext
Gas = types.Gas
@ -31,7 +30,6 @@ type (
GasConfig = types.GasConfig
)
// nolint - reexport
var (
PruneNothing = types.PruneNothing
PruneEverything = types.PruneEverything

View File

@ -9,7 +9,7 @@ import (
dbm "github.com/tendermint/tm-db"
)
type Store interface { //nolint
type Store interface {
GetStoreType() StoreType
CacheWrapper
}
@ -87,7 +87,7 @@ func (s *StoreUpgrades) RenamedFrom(key string) string {
}
type MultiStore interface { //nolint
type MultiStore interface {
Store
// Cache wrap MultiStore.
@ -236,7 +236,7 @@ type CacheWrap interface {
CacheWrapWithTrace(w io.Writer, tc TraceContext) CacheWrap
}
type CacheWrapper interface { //nolint
type CacheWrapper interface {
// CacheWrap cache wraps.
CacheWrap() CacheWrap
@ -253,7 +253,7 @@ type CommitID struct {
Hash []byte
}
func (cid CommitID) IsZero() bool { //nolint
func (cid CommitID) IsZero() bool {
return cid.Version == 0 && len(cid.Hash) == 0
}
@ -268,7 +268,6 @@ func (cid CommitID) String() string {
type StoreType int
const (
//nolint
StoreTypeMulti StoreType = iota
StoreTypeDB
StoreTypeIAVL

View File

@ -563,7 +563,6 @@ func removeZeroCoins(coins Coins) Coins {
//-----------------------------------------------------------------------------
// Sort interface
//nolint
func (coins Coins) Len() int { return len(coins) }
func (coins Coins) Less(i, j int) bool { return coins[i].Denom < coins[j].Denom }
func (coins Coins) Swap(i, j int) { coins[i], coins[j] = coins[j], coins[i] }

View File

@ -575,7 +575,6 @@ func removeZeroDecCoins(coins DecCoins) DecCoins {
var _ sort.Interface = Coins{}
//nolint
func (coins DecCoins) Len() int { return len(coins) }
func (coins DecCoins) Less(i, j int) bool { return coins[i].Denom < coins[j].Denom }
func (coins DecCoins) Swap(i, j int) { coins[i], coins[j] = coins[j], coins[i] }

View File

@ -1,10 +1,5 @@
package types
import (
_ "github.com/gogo/protobuf/gogoproto" // nolint
_ "github.com/regen-network/cosmos-proto" // nolint
)
// CustomProtobufType defines the interface custom gogo proto types must implement
// in order to be used as a "customtype" extension.
//

View File

@ -6,12 +6,10 @@ import (
"github.com/cosmos/cosmos-sdk/store/types"
)
// nolint - reexport
type (
PruningOptions = types.PruningOptions
)
// nolint - reexport
type (
Store = types.Store
Committer = types.Committer
@ -57,7 +55,6 @@ func DiffKVStores(a KVStore, b KVStore, prefixesToSkip [][]byte) (kvAs, kvBs []t
return types.DiffKVStores(a, b, prefixesToSkip)
}
// nolint - reexport
type (
CacheKVStore = types.CacheKVStore
CommitKVStore = types.CommitKVStore
@ -66,10 +63,8 @@ type (
CommitID = types.CommitID
)
// nolint - reexport
type StoreType = types.StoreType
// nolint - reexport
const (
StoreTypeMulti = types.StoreTypeMulti
StoreTypeDB = types.StoreTypeDB
@ -78,7 +73,6 @@ const (
StoreTypeMemory = types.StoreTypeMemory
)
// nolint - reexport
type (
StoreKey = types.StoreKey
CapabilityKey = types.CapabilityKey
@ -158,25 +152,21 @@ type TraceContext = types.TraceContext
// --------------------------------------
// nolint - reexport
type (
Gas = types.Gas
GasMeter = types.GasMeter
GasConfig = types.GasConfig
)
// nolint - reexport
func NewGasMeter(limit Gas) GasMeter {
return types.NewGasMeter(limit)
}
// nolint - reexport
type (
ErrorOutOfGas = types.ErrorOutOfGas
ErrorGasOverflow = types.ErrorGasOverflow
)
// nolint - reexport
func NewInfiniteGasMeter() GasMeter {
return types.NewInfiniteGasMeter()
}

View File

@ -77,7 +77,6 @@ func NewTestMsg(addrs ...AccAddress) *TestMsg {
}
}
//nolint
func (msg *TestMsg) Route() string { return "TestMsg" }
func (msg *TestMsg) Type() string { return "Test message" }
func (msg *TestMsg) GetSignBytes() []byte {

View File

@ -1,4 +1,3 @@
// nolint noalias
package types
import (

View File

@ -1,4 +1,3 @@
// nolint noalias
package types
import (

View File

@ -1,7 +1,5 @@
package bank
// nolint
import (
"github.com/cosmos/cosmos-sdk/x/bank/keeper"
"github.com/cosmos/cosmos-sdk/x/bank/types"

View File

@ -107,7 +107,7 @@ func supplyOfHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
denom := mux.Vars(r)["denom"]
cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r)
if !ok { //nolint:unparam
if !ok {
return
}

View File

@ -7,14 +7,12 @@ import (
// DONTCOVER
// nolint
const (
ModuleName = types.ModuleName
StoreKey = types.StoreKey
MemStoreKey = types.MemStoreKey
)
// nolint
var (
NewKeeper = keeper.NewKeeper
NewCapability = types.NewCapability
@ -30,12 +28,11 @@ var (
NewCapabilityOwners = types.NewCapabilityOwners
)
// nolint
type (
Keeper = keeper.Keeper
ScopedKeeper = keeper.ScopedKeeper
Capability = types.Capability
CapabilityOwners = types.CapabilityOwners
GenesisState = types.GenesisState
GenesisOwners = types.GenesisOwners
Keeper = keeper.Keeper
ScopedKeeper = keeper.ScopedKeeper
Capability = types.Capability
Owners = types.CapabilityOwners
GenesisState = types.GenesisState
GenesisOwners = types.GenesisOwners
)

View File

@ -1,7 +1,5 @@
package crisis
// nolint
import (
"github.com/cosmos/cosmos-sdk/x/crisis/keeper"
"github.com/cosmos/cosmos-sdk/x/crisis/types"

View File

@ -18,7 +18,6 @@ func NewMsgVerifyInvariant(sender sdk.AccAddress, invariantModuleName,
}
}
//nolint
func (msg MsgVerifyInvariant) Route() string { return ModuleName }
func (msg MsgVerifyInvariant) Type() string { return "verify_invariant" }

View File

@ -6,8 +6,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/distribution/types"
)
// nolint
const (
ModuleName = types.ModuleName
StoreKey = types.StoreKey

View File

@ -5,8 +5,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/evidence/types"
)
// nolint
const (
ModuleName = types.ModuleName
StoreKey = types.StoreKey

View File

@ -1,8 +1,8 @@
// nolint
package genutil
// autogenerated code using github.com/rigelrozanski/multitool
// aliases generated for the following subdirectories:
// ALIASGEN: github.com/cosmos/cosmos-sdk/x/genutil/types
package genutil
import (
"github.com/cosmos/cosmos-sdk/x/genutil/types"

View File

@ -207,7 +207,7 @@ func readUnsignedGenTxFile(cdc *codec.Codec, r io.Reader) (auth.StdTx, error) {
var stdTx auth.StdTx
bytes, err := ioutil.ReadAll(r)
if err != nil { // nolint:unparam
if err != nil {
return stdTx, err
}
@ -224,7 +224,7 @@ func writeSignedGenTx(cdc *codec.Codec, outputDocument string, tx auth.StdTx) er
defer outputFile.Close()
json, err := cdc.MarshalJSON(tx)
if err != nil { //nolint:unparam
if err != nil {
return err
}

View File

@ -59,7 +59,7 @@ func displayInfo(cdc codec.JSONMarshaler, info printInfo) error {
// InitCmd returns a command that initializes all files needed for Tendermint
// and the respective application.
func InitCmd(ctx *server.Context, cdc codec.JSONMarshaler, mbm module.BasicManager, defaultNodeHome string) *cobra.Command { // nolint: golint
func InitCmd(ctx *server.Context, cdc codec.JSONMarshaler, mbm module.BasicManager, defaultNodeHome string) *cobra.Command {
cmd := &cobra.Command{
Use: "init [moniker]",
Short: "Initialize private validator, p2p, genesis, and application configuration files",

View File

@ -74,7 +74,7 @@ func CollectStdTxs(cdc *codec.Codec, moniker, genTxsDir string,
var fos []os.FileInfo
fos, err = ioutil.ReadDir(genTxsDir)
if err != nil { //nolint:unparam
if err != nil {
return appGenTxs, persistentPeers, err
}

View File

@ -1,7 +1,5 @@
package gov
// nolint
import (
"github.com/cosmos/cosmos-sdk/x/gov/keeper"
"github.com/cosmos/cosmos-sdk/x/gov/types"

View File

@ -12,7 +12,7 @@ import (
func (keeper Keeper) GetDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress) (deposit types.Deposit, found bool) {
store := ctx.KVStore(keeper.storeKey)
bz := store.Get(types.DepositKey(proposalID, depositorAddr))
if bz == nil { //nolint:unparam
if bz == nil {
return deposit, false
}

View File

@ -225,7 +225,6 @@ func (msg MsgSubmitProposal) GetSignBytes() []byte {
return sdk.MustSortJSON(bz)
}
// nolint
func (msg MsgSubmitProposal) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{msg.Proposer} }
func (msg MsgSubmitProposal) Route() string { return RouterKey }
func (msg MsgSubmitProposal) Type() string { return TypeMsgSubmitProposal }

View File

@ -1,6 +1,5 @@
package client
// nolint
// autogenerated code using github.com/rigelrozanski/multitool
// aliases generated for the following subdirectories:
// ALIASGEN: github.com/cosmos/cosmos-sdk/x/ibc/02-client/keeper
@ -48,10 +47,9 @@ var (
AttributeValueCategory = types.AttributeValueCategory
)
// nolint
type (
Keeper = keeper.Keeper
StakingKeeper = types.StakingKeeper
GenesisState = types.GenesisState
ClientConsensusStates = types.ClientConsensusStates
Keeper = keeper.Keeper
StakingKeeper = types.StakingKeeper
GenesisState = types.GenesisState
ConsensusStates = types.ClientConsensusStates
)

View File

@ -1,6 +1,5 @@
package connection
// nolint
// autogenerated code using github.com/rigelrozanski/multitool
// aliases generated for the following subdirectories:
// ALIASGEN: github.com/cosmos/cosmos-sdk/x/ibc/03-connection/keeper
@ -62,19 +61,18 @@ var (
AttributeValueCategory = types.AttributeValueCategory
)
// nolint: golint
type (
Keeper = keeper.Keeper
ConnectionEnd = types.ConnectionEnd
End = types.ConnectionEnd
Counterparty = types.Counterparty
ClientKeeper = types.ClientKeeper
MsgConnectionOpenInit = types.MsgConnectionOpenInit
MsgConnectionOpenTry = types.MsgConnectionOpenTry
MsgConnectionOpenAck = types.MsgConnectionOpenAck
MsgConnectionOpenConfirm = types.MsgConnectionOpenConfirm
ConnectionResponse = types.ConnectionResponse
Response = types.ConnectionResponse
ClientConnectionsResponse = types.ClientConnectionsResponse
QueryClientConnectionsParams = types.QueryClientConnectionsParams
GenesisState = types.GenesisState
ConnectionPaths = types.ConnectionPaths
Paths = types.ConnectionPaths
)

View File

@ -1,6 +1,5 @@
package channel
// nolint
// autogenerated code using github.com/rigelrozanski/multitool
// aliases generated for the following subdirectories:
// ALIASGEN: github.com/cosmos/cosmos-sdk/x/ibc/04-channel/keeper

View File

@ -1,6 +1,5 @@
package port
// nolint
// autogenerated code using github.com/rigelrozanski/multitool
// aliases generated for the following subdirectories:
// ALIASGEN: github.com/cosmos/cosmos-sdk/x/ibc/05-port/keeper

View File

@ -146,7 +146,7 @@ func (suite *TendermintTestSuite) TestVerifyConnectionState() {
testCases := []struct {
name string
clientState ibctmtypes.ClientState
connection connection.ConnectionEnd
connection connection.End
consensusState ibctmtypes.ConsensusState
prefix commitmenttypes.MerklePrefix
proof commitmenttypes.MerkleProof

View File

@ -100,7 +100,7 @@ func (suite *LocalhostTestSuite) TestVerifyConnectionState() {
testCases := []struct {
name string
clientState types.ClientState
connection connection.ConnectionEnd
connection connection.End
prefix commitmenttypes.MerklePrefix
proof commitmenttypes.MerkleProof
expPass bool

View File

@ -1,6 +1,5 @@
package transfer
// nolint
// autogenerated code using github.com/rigelrozanski/multitool
// aliases generated for the following subdirectories:
// ALIASGEN: github.com/cosmos/cosmos-sdk/x/ibc/20-transfer/keeper

View File

@ -41,7 +41,7 @@ type ClientKeeper interface {
// ConnectionKeeper defines the expected IBC connection keeper
type ConnectionKeeper interface {
GetConnection(ctx sdk.Context, connectionID string) (connection connection.ConnectionEnd, found bool)
GetConnection(ctx sdk.Context, connectionID string) (connection connection.End, found bool)
}
// PortKeeper defines the expected IBC port keeper

View File

@ -1,6 +1,5 @@
package ibc
// nolint
// autogenerated code using github.com/rigelrozanski/multitool
// aliases generated for the following subdirectories:
// ALIASGEN: github.com/cosmos/cosmos-sdk/x/ibc/keeper

View File

@ -31,7 +31,7 @@ func (suite *IBCTestSuite) TestValidateGenesis() {
ibctmtypes.NewClientState(clientID, trustingPeriod, ubdPeriod, maxClockDrift, suite.header),
localhosttypes.NewClientState(suite.store, "chaindID", 10),
},
[]client.ClientConsensusStates{
[]client.ConsensusStates{
client.NewClientConsensusStates(
clientID,
[]exported.ConsensusState{
@ -43,10 +43,10 @@ func (suite *IBCTestSuite) TestValidateGenesis() {
},
),
ConnectionGenesis: connection.NewGenesisState(
[]connection.ConnectionEnd{
[]connection.End{
connection.NewConnectionEnd(ibctypes.INIT, connectionID, clientID, connection.NewCounterparty(clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))), []string{"1.0.0"}),
},
[]connection.ConnectionPaths{
[]connection.Paths{
connection.NewConnectionPaths(clientID, []string{ibctypes.ConnectionPath(connectionID)}),
},
),
@ -94,10 +94,10 @@ func (suite *IBCTestSuite) TestValidateGenesis() {
genState: ibc.GenesisState{
ClientGenesis: client.DefaultGenesisState(),
ConnectionGenesis: connection.NewGenesisState(
[]connection.ConnectionEnd{
[]connection.End{
connection.NewConnectionEnd(ibctypes.INIT, connectionID, "CLIENTIDONE", connection.NewCounterparty(clientID, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))), []string{"1.0.0"}),
},
[]connection.ConnectionPaths{
[]connection.Paths{
connection.NewConnectionPaths(clientID, []string{ibctypes.ConnectionPath(connectionID)}),
},
),

View File

@ -1,7 +1,5 @@
package mint
// nolint
import (
"github.com/cosmos/cosmos-sdk/x/mint/keeper"
"github.com/cosmos/cosmos-sdk/x/mint/types"

View File

@ -58,7 +58,7 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger {
func (k Keeper) GetMinter(ctx sdk.Context) (minter types.Minter) {
store := ctx.KVStore(k.storeKey)
b := store.Get(types.MinterKey)
if b == nil { //nolint:unparam
if b == nil {
panic("stored minter should not have been nil")
}

View File

@ -3,7 +3,6 @@ package types
// MinterKey is the key to use for the keeper store.
var MinterKey = []byte{0x00}
// nolint
const (
// module name
ModuleName = "mint"

View File

@ -1,7 +1,5 @@
package params
// nolint
import (
"github.com/cosmos/cosmos-sdk/x/params/keeper"
"github.com/cosmos/cosmos-sdk/x/params/types"

View File

@ -1,7 +1,5 @@
package slashing
// nolint
import (
"github.com/cosmos/cosmos-sdk/x/slashing/keeper"
"github.com/cosmos/cosmos-sdk/x/slashing/types"

View File

@ -1,6 +1,5 @@
package cli
// nolint
const (
FlagAddressValidator = "validator"
)

View File

@ -1,4 +1,3 @@
// nolint
package keeper
import (

View File

@ -14,7 +14,6 @@ func NewMsgUnjail(validatorAddr sdk.ValAddress) MsgUnjail {
}
}
//nolint
func (msg MsgUnjail) Route() string { return RouterKey }
func (msg MsgUnjail) Type() string { return "unjail" }
func (msg MsgUnjail) GetSigners() []sdk.AccAddress {

View File

@ -1,7 +1,5 @@
package upgrade
// nolint
import (
"github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
"github.com/cosmos/cosmos-sdk/x/upgrade/types"

View File

@ -25,7 +25,6 @@ func init() {
gov.RegisterProposalTypeCodec(&CancelSoftwareUpgradeProposal{}, "cosmos-sdk/CancelSoftwareUpgradeProposal")
}
// nolint
func (sup *SoftwareUpgradeProposal) GetTitle() string { return sup.Title }
func (sup *SoftwareUpgradeProposal) GetDescription() string { return sup.Description }
func (sup *SoftwareUpgradeProposal) ProposalRoute() string { return RouterKey }
@ -51,7 +50,6 @@ func NewCancelSoftwareUpgradeProposal(title, description string) gov.Content {
// Implements Proposal Interface
var _ gov.Content = &CancelSoftwareUpgradeProposal{}
// nolint
func (sup *CancelSoftwareUpgradeProposal) GetTitle() string { return sup.Title }
func (sup *CancelSoftwareUpgradeProposal) GetDescription() string { return sup.Description }
func (sup *CancelSoftwareUpgradeProposal) ProposalRoute() string { return RouterKey }