Skip to content

Commit

Permalink
linter: enable nolintlint (cosmos#6162)
Browse files Browse the repository at this point in the history
* nolintlint enable

* remove space

* fix tests

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
tac0turtle and mergify[bot] authored May 8, 2020
1 parent 4e328d7 commit bef3689
Show file tree
Hide file tree
Showing 49 changed files with 41 additions and 105 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ linters:
- unparam
- misspell
# - wsl
# - nolintlint
- nolintlint

issues:
exclude-rules:
Expand Down
1 change: 0 additions & 1 deletion client/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion client/tx/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
8 changes: 4 additions & 4 deletions crypto/keyring/keyring.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down
1 change: 0 additions & 1 deletion std/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
1 change: 0 additions & 1 deletion store/mem/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
6 changes: 2 additions & 4 deletions store/reexport.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
)

// Import cosmos-sdk/types/store.go for convenience.
// nolint
type (
PruningOptions = types.PruningOptions
Store = types.Store
Expand All @@ -22,16 +21,15 @@ 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
GasMeter = types.GasMeter
GasConfig = types.GasConfig
)

// nolint - reexport
var (
PruneNothing = types.PruneNothing
PruneEverything = types.PruneEverything
Expand Down
9 changes: 4 additions & 5 deletions store/types/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
dbm "github.com/tendermint/tm-db"
)

type Store interface { //nolint
type Store interface {
GetStoreType() StoreType
CacheWrapper
}
Expand Down Expand Up @@ -87,7 +87,7 @@ func (s *StoreUpgrades) RenamedFrom(key string) string {

}

type MultiStore interface { //nolint
type MultiStore interface {
Store

// Cache wrap MultiStore.
Expand Down Expand Up @@ -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

Expand All @@ -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
}

Expand All @@ -268,7 +268,6 @@ func (cid CommitID) String() string {
type StoreType int

const (
//nolint
StoreTypeMulti StoreType = iota
StoreTypeDB
StoreTypeIAVL
Expand Down
1 change: 0 additions & 1 deletion types/coin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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] }
Expand Down
1 change: 0 additions & 1 deletion types/dec_coin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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] }
Expand Down
5 changes: 0 additions & 5 deletions types/proto.go
Original file line number Diff line number Diff line change
@@ -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.
//
Expand Down
10 changes: 0 additions & 10 deletions types/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -66,10 +63,8 @@ type (
CommitID = types.CommitID
)

// nolint - reexport
type StoreType = types.StoreType

// nolint - reexport
const (
StoreTypeMulti = types.StoreTypeMulti
StoreTypeDB = types.StoreTypeDB
Expand All @@ -78,7 +73,6 @@ const (
StoreTypeMemory = types.StoreTypeMemory
)

// nolint - reexport
type (
StoreKey = types.StoreKey
CapabilityKey = types.CapabilityKey
Expand Down Expand Up @@ -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()
}
1 change: 0 additions & 1 deletion types/tx_msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion x/auth/types/test_utils.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// nolint noalias
package types

import (
Expand Down
1 change: 0 additions & 1 deletion x/auth/vesting/types/test_common.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// nolint noalias
package types

import (
Expand Down
2 changes: 0 additions & 2 deletions x/bank/alias.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package bank

// nolint

import (
"github.com/cosmos/cosmos-sdk/x/bank/keeper"
"github.com/cosmos/cosmos-sdk/x/bank/types"
Expand Down
2 changes: 1 addition & 1 deletion x/bank/client/rest/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
15 changes: 6 additions & 9 deletions x/capability/alias.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
)
2 changes: 0 additions & 2 deletions x/crisis/alias.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package crisis

// nolint

import (
"github.com/cosmos/cosmos-sdk/x/crisis/keeper"
"github.com/cosmos/cosmos-sdk/x/crisis/types"
Expand Down
1 change: 0 additions & 1 deletion x/crisis/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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" }

Expand Down
2 changes: 0 additions & 2 deletions x/distribution/alias.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/distribution/types"
)

// nolint

const (
ModuleName = types.ModuleName
StoreKey = types.StoreKey
Expand Down
2 changes: 0 additions & 2 deletions x/evidence/alias.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/evidence/types"
)

// nolint

const (
ModuleName = types.ModuleName
StoreKey = types.StoreKey
Expand Down
4 changes: 2 additions & 2 deletions x/genutil/alias.go
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
4 changes: 2 additions & 2 deletions x/genutil/client/cli/gentx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion x/genutil/client/cli/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion x/genutil/collect.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 0 additions & 2 deletions x/gov/alias.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package gov

// nolint

import (
"github.com/cosmos/cosmos-sdk/x/gov/keeper"
"github.com/cosmos/cosmos-sdk/x/gov/types"
Expand Down
Loading

0 comments on commit bef3689

Please sign in to comment.