Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix linting #9531

Merged
merged 1 commit into from
Jun 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ issues:
- text: "ST1016:"
linters:
- stylecheck
- text: "SA1019: codec.LegacyAmino is deprecated"
linters:
- staticcheck
max-issues-per-linter: 10000
max-same-issues: 10000

Expand Down
2 changes: 1 addition & 1 deletion client/docs/statik/init.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package statik

//This just for fixing the error in importing empty github.com/cosmos/cosmos-sdk/client/docs/statik
// This just for fixing the error in importing empty github.com/cosmos/cosmos-sdk/client/docs/statik
1 change: 1 addition & 0 deletions client/rest/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func addHTTPDeprecationHeaders(h http.Handler) http.Handler {
})
}

// nolint
// WithHTTPDeprecationHeaders returns a new *mux.Router, identical to its input
// but with the addition of HTTP Deprecation headers. This is used to mark legacy
// amino REST endpoints as deprecated in the REST API.
Expand Down
2 changes: 1 addition & 1 deletion client/rpc/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/cosmos/cosmos-sdk/types/rest"
)

//BlockCommand returns the verified block data for a given heights
// BlockCommand returns the verified block data for a given heights
func BlockCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "block [height]",
Expand Down
2 changes: 1 addition & 1 deletion client/rpc/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

// TODO these next two functions feel kinda hacky based on their placement

//ValidatorCommand returns the validator set for a given height
// ValidatorCommand returns the validator set for a given height
func ValidatorCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "tendermint-validator-set [height]",
Expand Down
2 changes: 1 addition & 1 deletion codec/amino.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/cosmos/cosmos-sdk/codec/types"
)

// deprecated: LegacyAmino defines a wrapper for an Amino codec that properly handles protobuf
// Deprecated: LegacyAmino defines a wrapper for an Amino codec that properly handles protobuf
// types with Any's
type LegacyAmino struct {
Amino *amino.Codec
Expand Down
1 change: 1 addition & 0 deletions crypto/keyring/legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func NewLegacy(name, dir string, opts ...KeybaseOption) (LegacyKeybase, error) {

var _ LegacyKeybase = dbKeybase{}

// nolint
// dbKeybase combines encryption and storage implementation to provide a
// full-featured key manager.
//
Expand Down
4 changes: 2 additions & 2 deletions simapp/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@ func createIncrementalAccounts(accNum int) []sdk.AccAddress {
// start at 100 so we can make up to 999 test addresses with valid test addresses
for i := 100; i < (accNum + 100); i++ {
numString := strconv.Itoa(i)
buffer.WriteString("A58856F0FD53BF058B4909A21AEC019107BA6") //base address string
buffer.WriteString("A58856F0FD53BF058B4909A21AEC019107BA6") // base address string

buffer.WriteString(numString) //adding on final two digits to make addresses unique
buffer.WriteString(numString) // adding on final two digits to make addresses unique
res, _ := sdk.AccAddressFromHex(buffer.String())
bech := res.String()
addr, _ := TestAddr(buffer.String(), bech)
Expand Down
1 change: 0 additions & 1 deletion store/gaskv/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ type Store struct {
}

// NewStore returns a reference to a new GasKVStore.
// nolint
func NewStore(parent types.KVStore, gasMeter types.GasMeter, gasConfig types.GasConfig) *Store {
kvs := &Store{
gasMeter: gasMeter,
Expand Down
13 changes: 6 additions & 7 deletions types/decimal.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func precisionMultiplier(prec int64) *big.Int {
return precisionMultipliers[prec]
}

//______________________________________________________________________________________________
// ______________________________________________________________________________________________

// create a new Dec from integer assuming whole number
func NewDec(i int64) Dec {
Expand Down Expand Up @@ -198,8 +198,7 @@ func MustNewDecFromStr(s string) Dec {
return dec
}

//______________________________________________________________________________________________
//nolint
// ______________________________________________________________________________________________
func (d Dec) IsNil() bool { return d.i == nil } // is decimal nil
func (d Dec) IsZero() bool { return (d.i).Sign() == 0 } // is equal to zero
func (d Dec) IsNegative() bool { return (d.i).Sign() == -1 } // is negative
Expand Down Expand Up @@ -564,7 +563,7 @@ func (d Dec) RoundInt() Int {
return NewIntFromBigInt(chopPrecisionAndRoundNonMutative(d.i))
}

//___________________________________________________________________________________
// ___________________________________________________________________________________

// similar to chopPrecisionAndRound, but always rounds down
func chopPrecisionAndTruncate(d *big.Int) *big.Int {
Expand Down Expand Up @@ -615,7 +614,7 @@ func (d Dec) Ceil() Dec {
return NewDecFromBigInt(quo.Add(quo, oneInt))
}

//___________________________________________________________________________________
// ___________________________________________________________________________________

// MaxSortableDec is the largest Dec that can be passed into SortableDecBytes()
// Its negative form is the least Dec that can be passed in.
Expand Down Expand Up @@ -651,7 +650,7 @@ func SortableDecBytes(dec Dec) []byte {
return []byte(fmt.Sprintf(fmt.Sprintf("%%0%ds", Precision*2+1), dec.String()))
}

//___________________________________________________________________________________
// ___________________________________________________________________________________

// reuse nil values
var nilJSON []byte
Expand Down Expand Up @@ -761,7 +760,7 @@ func (dp DecProto) String() string {
return dp.Dec.String()
}

//___________________________________________________________________________________
// ___________________________________________________________________________________
// helpers

// test if two decimal arrays are equal
Expand Down
2 changes: 1 addition & 1 deletion types/decimal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (s *decimalTestSuite) mustNewDecFromStr(str string) (d sdk.Dec) {
return d
}

//_______________________________________
// _______________________________________

func (s *decimalTestSuite) TestNewDecFromStr() {
largeBigInt, success := new(big.Int).SetString("3144605511029693144278234343371835", 10)
Expand Down
1 change: 0 additions & 1 deletion types/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const UndefinedCodespace = "undefined"

var (
// errInternal should never be exposed, but we reserve this code for non-specified errors
//nolint
errInternal = Register(UndefinedCodespace, 1, "internal")

// ErrTxDecode is returned if we cannot parse a transaction
Expand Down
8 changes: 4 additions & 4 deletions types/module/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
)

//__________________________________________________________________________________________
// __________________________________________________________________________________________

// AppModuleBasic is the standard form for basic non-dependant elements of an application module.
type AppModuleBasic interface {
Expand Down Expand Up @@ -145,7 +145,7 @@ func (bm BasicManager) AddQueryCommands(rootQueryCmd *cobra.Command) {
}
}

//_________________________________________________________
// _________________________________________________________

// AppModuleGenesis is the standard form for an application module genesis functions
type AppModuleGenesis interface {
Expand Down Expand Up @@ -179,7 +179,7 @@ type AppModule interface {
EndBlock(sdk.Context, abci.RequestEndBlock) []abci.ValidatorUpdate
}

//___________________________
// ___________________________

// GenesisOnlyAppModule is an AppModule that only has import/export functionality
type GenesisOnlyAppModule struct {
Expand Down Expand Up @@ -216,7 +216,7 @@ func (GenesisOnlyAppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []ab
return []abci.ValidatorUpdate{}
}

//____________________________________________________________________________
// ____________________________________________________________________________

// Manager defines a module manager that provides the high level utility for managing and executing
// operations for a group of modules
Expand Down
4 changes: 2 additions & 2 deletions types/simulation/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ type Config struct {
ParamsFile string // custom simulation params file which overrides any random params; cannot be used with genesis

ExportParamsPath string // custom file path to save the exported params JSON
ExportParamsHeight int //height to which export the randomly generated params
ExportStatePath string //custom file path to save the exported app state JSON
ExportParamsHeight int // height to which export the randomly generated params
ExportStatePath string // custom file path to save the exported app state JSON
ExportStatsPath string // custom file path to save the exported simulation statistics JSON

Seed int64 // simulation random seed
Expand Down
2 changes: 1 addition & 1 deletion types/simulation/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (om OperationMsg) LogEvent(eventLogger func(route, op, evResult string)) {
eventLogger(om.Route, om.Name, pass)
}

//________________________________________________________________________
// ________________________________________________________________________

// FutureOperation is an operation which will be ran at the beginning of the
// provided BlockHeight. If both a BlockHeight and BlockTime are specified, it
Expand Down
2 changes: 1 addition & 1 deletion types/uint.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ func (u *Uint) Size() int {
func (u Uint) MarshalAmino() ([]byte, error) { return u.Marshal() }
func (u *Uint) UnmarshalAmino(bz []byte) error { return u.Unmarshal(bz) }

//__________________________________________________________________________
// __________________________________________________________________________

// UintOverflow returns true if a given unsigned integer overflows and false
// otherwise.
Expand Down
1 change: 0 additions & 1 deletion x/auth/legacy/v034/types.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// DONTCOVER
// nolint
package v034

import (
Expand Down
1 change: 0 additions & 1 deletion x/auth/legacy/v036/migrate.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// DONTCOVER
// nolint
package v036

import (
Expand Down
1 change: 0 additions & 1 deletion x/auth/legacy/v036/types.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// DONTCOVER
// nolint
package v036

import v034auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v034"
Expand Down
1 change: 0 additions & 1 deletion x/auth/legacy/v038/types.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package v038

// DONTCOVER
// nolint

import (
"bytes"
Expand Down
1 change: 0 additions & 1 deletion x/auth/legacy/v039/types.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package v039

// DONTCOVER
// nolint

import (
"bytes"
Expand Down
4 changes: 2 additions & 2 deletions x/auth/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry)
types.RegisterInterfaces(registry)
}

//____________________________________________________________________________
// ____________________________________________________________________________

// AppModule implements an application module for the auth module.
type AppModule struct {
Expand Down Expand Up @@ -156,7 +156,7 @@ func (AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.Validato
return []abci.ValidatorUpdate{}
}

//____________________________________________________________________________
// ____________________________________________________________________________

// AppModuleSimulation functions

Expand Down
2 changes: 1 addition & 1 deletion x/auth/testutil/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
)

// TxConfigTestSuite provides a test suite that can be used to test that a TxConfig implementation is correct
//nolint:golint // type name will be used as tx.TxConfigTestSuite by other packages, and that stutters; consider calling this GeneratorTestSuite
// type name will be used as tx.TxConfigTestSuite by other packages, and that stutters; consider calling this GeneratorTestSuite
type TxConfigTestSuite struct {
suite.Suite
TxConfig client.TxConfig
Expand Down
1 change: 0 additions & 1 deletion x/auth/types/account_retriever.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ func (ar AccountRetriever) GetAccount(clientCtx client.Context, addr sdk.AccAddr
// GetAccountWithHeight queries for an account given an address. Returns the
// height of the query with the account. An error is returned if the query
// or decoding fails.
//nolint:interfacer
func (ar AccountRetriever) GetAccountWithHeight(clientCtx client.Context, addr sdk.AccAddress) (client.Account, int64, error) {
var header metadata.MD

Expand Down
1 change: 0 additions & 1 deletion x/auth/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ func ParamKeyTable() paramtypes.KeyTable {

// ParamSetPairs implements the ParamSet interface and returns all the key/value pairs
// pairs of auth module's parameters.
// nolint
func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
return paramtypes.ParamSetPairs{
paramtypes.NewParamSetPair(KeyMaxMemoCharacters, &p.MaxMemoCharacters, validateMaxMemoCharacters),
Expand Down
1 change: 0 additions & 1 deletion x/bank/legacy/v036/types.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// DONTCOVER
// nolint
package v036

import (
Expand Down
1 change: 0 additions & 1 deletion x/bank/legacy/v038/types.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package v038

// DONTCOVER
// nolint

const (
ModuleName = "bank"
Expand Down
4 changes: 2 additions & 2 deletions x/bank/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry)
types.RegisterInterfaces(registry)
}

//____________________________________________________________________________
// ____________________________________________________________________________

// AppModule implements an application module for the bank module.
type AppModule struct {
Expand Down Expand Up @@ -160,7 +160,7 @@ func (AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.Validato
return []abci.ValidatorUpdate{}
}

//____________________________________________________________________________
// ____________________________________________________________________________

// AppModuleSimulation functions

Expand Down
4 changes: 0 additions & 4 deletions x/bank/simulation/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ func SimulateMsgSend(ak types.AccountKeeper, bk keeper.Keeper) simtypes.Operatio
}

// sendMsgSend sends a transaction with a MsgSend from a provided random account.
// nolint: interfacer
func sendMsgSend(
r *rand.Rand, app *baseapp.BaseApp, bk keeper.Keeper, ak types.AccountKeeper,
msg *types.MsgSend, ctx sdk.Context, chainID string, privkeys []cryptotypes.PrivKey,
Expand Down Expand Up @@ -222,8 +221,6 @@ func SimulateMsgMultiSend(ak types.AccountKeeper, bk keeper.Keeper) simtypes.Ope
}

// sendMsgMultiSend sends a transaction with a MsgMultiSend from a provided random
// account.
// nolint: interfacer
func sendMsgMultiSend(
r *rand.Rand, app *baseapp.BaseApp, bk keeper.Keeper, ak types.AccountKeeper,
msg *types.MsgMultiSend, ctx sdk.Context, chainID string, privkeys []cryptotypes.PrivKey,
Expand Down Expand Up @@ -289,7 +286,6 @@ func sendMsgMultiSend(

// randomSendFields returns the sender and recipient simulation accounts as well
// as the transferred amount.
// nolint: interfacer
func randomSendFields(
r *rand.Rand, ctx sdk.Context, accs []simtypes.Account, bk keeper.Keeper, ak types.AccountKeeper,
) (simtypes.Account, simtypes.Account, sdk.Coins, bool) {
Expand Down
2 changes: 1 addition & 1 deletion x/crisis/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func createTestApp() (*simapp.SimApp, sdk.Context, []sdk.AccAddress) {
return app, ctx, addrs
}

//____________________________________________________________________________
// ____________________________________________________________________________

func TestHandleMsgVerifyInvariant(t *testing.T) {
app, ctx, addrs := createTestApp()
Expand Down
16 changes: 8 additions & 8 deletions x/crisis/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ func (k Keeper) VerifyInvariant(goCtx context.Context, msg *types.MsgVerifyInvar
// refund is required.

// TODO uncomment the following code block with implementation of the circuit breaker
//// refund constant fee
//err := k.distrKeeper.DistributeFromFeePool(ctx, constantFee, msg.Sender)
//if err != nil {
//// if there are insufficient coins to refund, log the error,
//// but still halt the chain.
//logger := ctx.Logger().With("module", "x/crisis")
//logger.Error(fmt.Sprintf(
//"WARNING: insufficient funds to allocate to sender from fee pool, err: %s", err))
// // refund constant fee
// err := k.distrKeeper.DistributeFromFeePool(ctx, constantFee, msg.Sender)
// if err != nil {
// // if there are insufficient coins to refund, log the error,
// // but still halt the chain.
// logger := ctx.Logger().With("module", "x/crisis")
// logger.Error(fmt.Sprintf(
// "WARNING: insufficient funds to allocate to sender from fee pool, err: %s", err))
//}

// TODO replace with circuit breaker
Expand Down
2 changes: 1 addition & 1 deletion x/crisis/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry)
types.RegisterInterfaces(registry)
}

//____________________________________________________________________________
// ____________________________________________________________________________

// AppModule implements an application module for the crisis module.
type AppModule struct {
Expand Down
1 change: 0 additions & 1 deletion x/distribution/legacy/v034/types.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// DONTCOVER
// nolint
package v034

import (
Expand Down
Loading