Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
DongLieu committed Oct 11, 2023
1 parent fad0399 commit 0ff1c94
Show file tree
Hide file tree
Showing 25 changed files with 45 additions and 45 deletions.
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ func NewQuicksilver(
go func() {
// Unfortunately golangci-lint is so pedantic
// so we have to ignore this error explicitly.
_ = app.tpsCounter.start(context.Background()) //nolint:errcheck
_ = app.tpsCounter.start(context.Background()) // nolint:errcheck
}()

return app
Expand Down
2 changes: 1 addition & 1 deletion app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (app *Quicksilver) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAdd
// withdraw all validator commission
// withdraw all validator commission
app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) {
_, _ = app.DistrKeeper.WithdrawValidatorCommission(ctx, val.GetOperator()) //nolint
_, _ = app.DistrKeeper.WithdrawValidatorCommission(ctx, val.GetOperator()) // nolint
return false
})
// withdraw all delegator rewards
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (app *Quicksilver) setUpgradeStoreLoaders() {

var storeUpgrades *storetypes.StoreUpgrades

switch upgradeInfo.Name { //nolint:gocritic
switch upgradeInfo.Name { // nolint:gocritic
// case v001000UpgradeName:

// storeUpgrades = &storetypes.StoreUpgrades{
Expand Down
8 changes: 4 additions & 4 deletions app/upgrades/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,22 @@ type Upgrade struct {
StoreUpgrades storetypes.StoreUpgrades
}

//nolint:all //function useful for writing network specific upgrade handlers
// nolint:all //function useful for writing network specific upgrade handlers
func isTest(ctx sdk.Context) bool {
return ctx.ChainID() == TestChainID
}

//nolint:all //function useful for writing network specific upgrade handlers
// nolint:all //function useful for writing network specific upgrade handlers
func isDevnet(ctx sdk.Context) bool {
return ctx.ChainID() == DevnetChainID
}

//nolint:all //function useful for writing network specific upgrade handlers
// nolint:all //function useful for writing network specific upgrade handlers
func isTestnet(ctx sdk.Context) bool {
return ctx.ChainID() == RhyeChainID
}

//nolint:all //function useful for writing network specific upgrade handlers
// nolint:all //function useful for writing network specific upgrade handlers
func isMainnet(ctx sdk.Context) bool {
return ctx.ChainID() == ProductionChainID
}
6 changes: 3 additions & 3 deletions cmd/quicksilverd/bulk_airdrop.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,13 @@ func BulkGenesisAirdropCmd(defaultNodeHome string) *cobra.Command {
}

for _, zd := range airdropGenState.ZoneDrops {
if zd.ChainId == claimRecords[0].ChainId { //nolint:gosec
if zd.ChainId == claimRecords[0].ChainId { // nolint:gosec
zoneDrop = zd
}
}

if zoneDrop == nil {
return fmt.Errorf("zoneDrop doesn't exist for chain ID: %s", claimRecords[0].ChainId) //nolint:gosec // TODO: remove
return fmt.Errorf("zoneDrop doesn't exist for chain ID: %s", claimRecords[0].ChainId) // nolint:gosec // TODO: remove
}

authGenState := authtypes.GetGenesisStateFromAppState(clientCtx.Codec, appState)
Expand All @@ -211,7 +211,7 @@ func BulkGenesisAirdropCmd(defaultNodeHome string) *cobra.Command {
existing := airdropGenState.ClaimRecords

for _, i := range existing {
if i.ChainId == claimRecords[0].ChainId { //nolint:gosec // TODO: remove
if i.ChainId == claimRecords[0].ChainId { // nolint:gosec // TODO: remove
zoneclaims[i.Address] = true
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ func Handler(title, specURL string) http.HandlerFunc {
}{
title,
specURL,
}) //nolint:errcheck non-critical for docs
}) // nolint:errcheck non-critical for docs
}
}
2 changes: 1 addition & 1 deletion test/simulation/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
// SetupSimulation creates the config, db (levelDB), temporary directory and logger for
// the simulation tests. If `FlagEnabledValue` is false it skips the current test.
// Returns error on an invalid db instantiation or temp dir creation.
func SetupSimulation(dirPrefix, dbName string) (simtypes.Config, dbm.DB, string, log.Logger, bool, error) { //nolint:gocritic test util does not need to be simplified
func SetupSimulation(dirPrefix, dbName string) (simtypes.Config, dbm.DB, string, log.Logger, bool, error) { // nolint:gocritic test util does not need to be simplified
if !FlagEnabledValue {
return simtypes.Config{}, nil, "", nil, true, nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/quicksilver-zone/quicksilver/utils/addressutils"
)

//nolint:deadcode
// nolint:deadcode
const (
nonPostiveSharesAmountErrFormat = "shares amount must be positive, was %d"
nonPostiveTokenAmountErrFormat = "token amount must be positive, was %d"
Expand Down
10 changes: 5 additions & 5 deletions third-party-chains/osmosis-types/osmoutils/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ type Proposal struct {
}

var ProposalFlags = []string{
cli.FlagTitle, //nolint:staticcheck // using this to support govv1beta1
cli.FlagDescription, //nolint:staticcheck // using this to support govv1beta1
cli.FlagTitle, // nolint:staticcheck // using this to support govv1beta1
cli.FlagDescription, // nolint:staticcheck // using this to support govv1beta1
cli.FlagDeposit,
}

Expand All @@ -35,11 +35,11 @@ func (p Proposal) validate() error {

func ParseProposalFlags(fs *pflag.FlagSet) (*Proposal, error) {
proposal := &Proposal{}
proposalFile, _ := fs.GetString(cli.FlagProposal) //nolint:staticcheck // using this to support govv1beta1
proposalFile, _ := fs.GetString(cli.FlagProposal) // nolint:staticcheck // using this to support govv1beta1

if proposalFile == "" {
proposal.Title, _ = fs.GetString(cli.FlagTitle) //nolint:staticcheck // using this to support govv1beta1
proposal.Description, _ = fs.GetString(cli.FlagDescription) //nolint:staticcheck // using this to support govv1beta1
proposal.Title, _ = fs.GetString(cli.FlagTitle) // nolint:staticcheck // using this to support govv1beta1
proposal.Description, _ = fs.GetString(cli.FlagDescription) // nolint:staticcheck // using this to support govv1beta1
proposal.Deposit, _ = fs.GetString(cli.FlagDeposit)
if err := proposal.validate(); err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion tools/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package tools
// https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module
// https://github.com/golang/go/issues/25922

//nolint:all
// nolint:all
import (
_ "github.com/client9/misspell/cmd/misspell"
_ "github.com/golangci/golangci-lint/cmd/golangci-lint"
Expand Down
2 changes: 1 addition & 1 deletion utils/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func VerifyAdjacent(
untrustedVals *types.ValidatorSet, // height=X+1
trustingPeriod time.Duration,
now time.Time,
maxClockDrift time.Duration, //nolint:revive
maxClockDrift time.Duration, // nolint:revive
) error {
if untrustedHeader.Height != trustedHeader.Height+1 {
return errors.New("headers must be adjacent in height")
Expand Down
2 changes: 1 addition & 1 deletion wasmbinding/query_plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"time"

wasmvmtypes "github.com/CosmWasm/wasmvm/types"
"github.com/golang/protobuf/proto" //nolint:staticcheck
"github.com/golang/protobuf/proto" // nolint:staticcheck
"github.com/stretchr/testify/suite"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"

Expand Down
6 changes: 3 additions & 3 deletions wasmbinding/test/custom_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (
)

// we must pay this many uosmo for every pool we create.
var poolFee int64 = 1000000000 //nolint:unused
var poolFee int64 = 1000000000 // nolint:unused

var defaultFunds = sdk.NewCoins( //nolint:unused
var defaultFunds = sdk.NewCoins( // nolint:unused
sdk.NewInt64Coin("qck", 333000000),
sdk.NewInt64Coin("umai", 555000000+2*poolFee),
sdk.NewInt64Coin("uck", 999000000),
Expand Down Expand Up @@ -139,7 +139,7 @@ func instantiateReflectContract(t *testing.T, ctx sdk.Context, quicksilverApp *a
return addr
}

func fundAccount(t *testing.T, ctx sdk.Context, quicksilver *app.Quicksilver, addr sdk.AccAddress, coins sdk.Coins) { //nolint:unused
func fundAccount(t *testing.T, ctx sdk.Context, quicksilver *app.Quicksilver, addr sdk.AccAddress, coins sdk.Coins) { // nolint:unused
t.Helper()

err := FundAccount(
Expand Down
2 changes: 1 addition & 1 deletion wasmbinding/test/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func CreateTestInput(t *testing.T) (*app.Quicksilver, sdk.Context) {
}

// we need to make this deterministic (same every test run), as content might affect gas costs.
func keyPubAddr() (key crypto.PrivKey, pub crypto.PubKey, addr sdk.AccAddress) { //nolint:unparam
func keyPubAddr() (key crypto.PrivKey, pub crypto.PubKey, addr sdk.AccAddress) { // nolint:unparam
key = ed25519.GenPrivKey()
pub = key.PubKey()
addr = sdk.AccAddress(pub.Address())
Expand Down
4 changes: 2 additions & 2 deletions x/interchainstaking/keeper/ibc_packet_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strings"
"time"

"github.com/golang/protobuf/proto" //nolint:staticcheck
"github.com/golang/protobuf/proto" // nolint:staticcheck
lsmstakingtypes "github.com/iqlusioninc/liquidity-staking-module/x/staking/types"

sdkmath "cosmossdk.io/math"
Expand Down Expand Up @@ -108,7 +108,7 @@ func (k *Keeper) HandleAcknowledgement(ctx sdk.Context, packet channeltypes.Pack

for msgIndex, msg := range msgs {
// use msgData for v0.45 and below and msgResponse for v0.46+
//nolint:staticcheck // SA1019 ignore this!
// nolint:staticcheck // SA1019 ignore this!
var msgResponse []byte

// check that the msgResponses slice is at least the length of the current index.
Expand Down
4 changes: 2 additions & 2 deletions x/interchainstaking/keeper/ibc_packet_handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1579,7 +1579,7 @@ func (suite *KeeperTestSuite) Test_v045Callback() {

txMsgData := &sdk.TxMsgData{
// we need to support this older deprecated type
Data: []*sdk.MsgData{{MsgType: "/bob", Data: msgResponseBytes}}, //nolint:staticcheck
Data: []*sdk.MsgData{{MsgType: "/bob", Data: msgResponseBytes}}, // nolint:staticcheck
MsgResponses: []*codectypes.Any{},
}

Expand Down Expand Up @@ -1710,7 +1710,7 @@ func (suite *KeeperTestSuite) Test_v046Callback() {
msg, anyResp := test.setStatements(ctx, quicksilver)

txMsgData := &sdk.TxMsgData{
Data: []*sdk.MsgData{}, //nolint:staticcheck
Data: []*sdk.MsgData{}, // nolint:staticcheck
MsgResponses: []*codectypes.Any{anyResp},
}

Expand Down
4 changes: 2 additions & 2 deletions x/interchainstaking/keeper/redemptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (k *Keeper) processRedemptionForLsm(ctx sdk.Context, zone *types.Zone, send
})
}
// add unallocated dust.
msgs[0].Amount = msgs[0].Amount.AddAmount(outstanding) //nolint:gosec
msgs[0].Amount = msgs[0].Amount.AddAmount(outstanding) // nolint:gosec
sdkMsgs := make([]sdk.Msg, 0)
for _, msg := range msgs {
sdkMsgs = append(sdkMsgs, sdk.Msg(msg))
Expand All @@ -81,7 +81,7 @@ func (k *Keeper) queueRedemption(
nativeTokens math.Int,
burnAmount sdk.Coin,
hash string,
) error { //nolint:unparam // we know that the error is always nil
) error { // nolint:unparam // we know that the error is always nil
distribution := make([]*types.Distribution, 0)
amount := sdk.NewCoins(sdk.NewCoin(zone.BaseDenom, nativeTokens))

Expand Down
4 changes: 2 additions & 2 deletions x/interchainstaking/types/accounts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ func TestAccountSetBalanceGood(t *testing.T) {
// tests that the balance panics when set to an invalid denomination.
func TestAccountSetBalanceBadDenom(t *testing.T) {
ica := NewICA()
require.PanicsWithError(t, "invalid denom: _fail", func() { ica.SetBalance(sdk.NewCoins(sdk.NewCoin("_fail", sdk.NewInt(300)))) }) //nolint:errcheck // we're checking for a panic with error here
require.PanicsWithError(t, "invalid denom: _fail", func() { ica.SetBalance(sdk.NewCoins(sdk.NewCoin("_fail", sdk.NewInt(300)))) }) // nolint:errcheck // we're checking for a panic with error here
}

// tests that the balance panics when set to a negative number.
func TestAccountSetBalanceNegativeAmount(t *testing.T) {
ica := NewICA()
require.PanicsWithError(t, "negative coin amount: -300", func() { ica.SetBalance(sdk.NewCoins(sdk.NewCoin("uqck", sdk.NewInt(-300)))) }) //nolint:errcheck // we're checking for a panic with error here
require.PanicsWithError(t, "negative coin amount: -300", func() { ica.SetBalance(sdk.NewCoins(sdk.NewCoin("uqck", sdk.NewInt(-300)))) }) // nolint:errcheck // we're checking for a panic with error here
}

// tests that the balance panics when set to a negative number.
Expand Down
4 changes: 2 additions & 2 deletions x/interchainstaking/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ func (p ParamsV1) ParamSetPairs() paramtypes.ParamSetPairs {
}

func (p Params) String() string {
out, _ := yaml.Marshal(p) //nolint:errcheck not needed
out, _ := yaml.Marshal(p) // nolint:errcheck not needed
return string(out)
}

// String implements the Stringer interface.
func (p ParamsV1) String() string {
out, _ := yaml.Marshal(p) //nolint:errcheck not needed
out, _ := yaml.Marshal(p) // nolint:errcheck not needed
return string(out)
}

Expand Down
2 changes: 1 addition & 1 deletion x/interchainstaking/types/redemptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func DetermineAllocationsForUndelegation(currentAllocations map[string]math.Int,
// negate all values in underallocated.
underAllocated.Negate()
// append the two slices
//nolint:gocritic
// nolint:gocritic
deltas := append(overAllocated, underAllocated...)
deltas.Sort()

Expand Down
2 changes: 1 addition & 1 deletion x/mint/simulation/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

// Simulation parameter constants.
const (
epochProvisionsKey = "genesis_epoch_provisions" //nolint:gosec // these are not hard coded credentials
epochProvisionsKey = "genesis_epoch_provisions" // nolint:gosec // these are not hard coded credentials
reductionFactorKey = "reduction_factor"
reductionPeriodInEpochsKey = "reduction_period_in_epochs"
distributionProportionsKey = "distribution_proportions"
Expand Down
2 changes: 1 addition & 1 deletion x/participationrewards/keeper/callbacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ func SetEpochBlockCallback(ctx sdk.Context, k *Keeper, args []byte, query icqtyp

if blockResponse.SdkBlock == nil {
// v0.45 and below
//nolint:staticcheck // SA1019 ignore this!
// nolint:staticcheck // SA1019 ignore this!
connectionData.LastEpoch = blockResponse.Block.Header.Height
} else {
// v0.46 and above
Expand Down
2 changes: 1 addition & 1 deletion x/tokenfactory/keeper/bankactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (k Keeper) burnFrom(ctx sdk.Context, amount sdk.Coin, burnFrom string) erro
return k.bankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(amount))
}

func (k Keeper) forceTransfer(ctx sdk.Context, amount sdk.Coin, fromAddr, toAddr string) error { //nolint:unused
func (k Keeper) forceTransfer(ctx sdk.Context, amount sdk.Coin, fromAddr, toAddr string) error { // nolint:unused

// verify that denom is an x/tokenfactory denom
_, _, err := types.DeconstructDenom(amount.Denom)
Expand Down
10 changes: 5 additions & 5 deletions x/tokenfactory/simulation/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ import (
)

const (
OpWeightMsgCreateDenom = "op_weight_msg_create_denom" //nolint:gosec // not credentials
OpWeightMsgMint = "op_weight_msg_mint" //nolint:gosec // not credentials
OpWeightMsgBurn = "op_weight_msg_burn" //nolint:gosec // not credentials
OpWeightMsgChangeAdmin = "op_weight_msg_change_admin" //nolint:gosec // not credentials
OpWeightMsgSetDenomMetadata = "op_weight_msg_set_denom_metadata" //nolint:gosec // not credentials
OpWeightMsgCreateDenom = "op_weight_msg_create_denom" // nolint:gosec // not credentials
OpWeightMsgMint = "op_weight_msg_mint" // nolint:gosec // not credentials
OpWeightMsgBurn = "op_weight_msg_burn" // nolint:gosec // not credentials
OpWeightMsgChangeAdmin = "op_weight_msg_change_admin" // nolint:gosec // not credentials
OpWeightMsgSetDenomMetadata = "op_weight_msg_set_denom_metadata" // nolint:gosec // not credentials
DefaultWeightMsgCreateDenom int = 50
DefaultWeightMsgMint int = 10
DefaultWeightMsgBurn int = 10
Expand Down
2 changes: 1 addition & 1 deletion x/tokenfactory/types/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package types

// event types

//nolint:gosec
// nolint:gosec
const (
AttributeAmount = "amount"
AttributeCreator = "creator"
Expand Down

0 comments on commit 0ff1c94

Please sign in to comment.