lint: fix many broken lint issues (#49)

* lint: fix many broken lint issues

* more lint issues resolved

* more lint issues resolved

* all actions issues fixed

* pin variables for websocket

* Update .github/workflows/lint.yml

* more fixes

* fix lint issues in pubsub, rpc, types

* fix lint issues in statedb, journal, pubsub, cli

* fix comment

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
Akash Khosla
2021-06-08 03:07:11 -04:00
committed by GitHub
co-authored by Federico Kunze
parent fcb7c114d0
commit e3270aee5d
19 changed files with 81 additions and 198 deletions
+6 -2
View File
@@ -72,9 +72,13 @@ func addTxFlags(cmd *cobra.Command) *cobra.Command {
//))
//viper.BindPFlag(flags.FlagTrustNode, cmd.Flags().Lookup(flags.FlagTrustNode))
viper.BindPFlag(flags.FlagNode, cmd.Flags().Lookup(flags.FlagNode))
viper.BindPFlag(flags.FlagKeyringBackend, cmd.Flags().Lookup(flags.FlagKeyringBackend))
// TODO: we need to handle the errors for these, decide if we should return error upward and handle
// nolint: errcheck
viper.BindPFlag(flags.FlagNode, cmd.Flags().Lookup(flags.FlagNode))
// nolint: errcheck
viper.BindPFlag(flags.FlagKeyringBackend, cmd.Flags().Lookup(flags.FlagKeyringBackend))
// nolint: errcheck
cmd.MarkFlagRequired(flags.FlagChainID)
return cmd
}
-1
View File
@@ -29,7 +29,6 @@ const (
flagVestingStart = "vesting-start-time"
flagVestingEnd = "vesting-end-time"
flagVestingAmt = "vesting-amount"
flagKeyring = "pass"
)
// AddGenesisAccountCmd returns add-genesis-account cobra Command.
+1 -28
View File
@@ -1,7 +1,6 @@
package main
import (
"context"
"io"
"math/big"
"os"
@@ -11,7 +10,6 @@ import (
"github.com/cosmos/cosmos-sdk/simapp/params"
"github.com/cosmos/cosmos-sdk/snapshots"
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/crisis"
"github.com/spf13/cast"
"github.com/spf13/cobra"
@@ -67,28 +65,6 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
},
}
initRootCmd(rootCmd, encodingConfig)
return rootCmd, encodingConfig
}
// Execute executes the root command.
func Execute(rootCmd *cobra.Command) error {
// Create and set a client.Context on the command's Context. During the pre-run
// of the root command, a default initialized client.Context is provided to
// seed child command execution with values such as AccountRetriver, Keyring,
// and a Tendermint RPC. This requires the use of a pointer reference when
// getting and setting the client.Context. Ideally, we utilize
// https://github.com/spf13/cobra/pull/1118.
ctx := context.Background()
ctx = context.WithValue(ctx, client.ClientContextKey, &client.Context{})
ctx = context.WithValue(ctx, sdkserver.ServerContextKey, sdkserver.NewDefaultContext())
executor := tmcli.PrepareBaseCmd(rootCmd, "", app.DefaultNodeHome)
return executor.ExecuteContext(ctx)
}
func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) {
authclient.Codec = encodingConfig.Marshaler
sdk.PowerReduction = sdk.NewIntFromBigInt(new(big.Int).Exp(big.NewInt(10), big.NewInt(18), nil))
@@ -137,10 +113,7 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) {
)
rootCmd = addTxFlags(rootCmd)
}
func addModuleInitFlags(startCmd *cobra.Command) {
crisis.AddModuleInitFlags(startCmd)
return rootCmd, encodingConfig
}
func queryCommand() *cobra.Command {
+5 -4
View File
@@ -45,7 +45,6 @@ import (
// Tendermint full-node start flags
const (
flagWithTendermint = "with-tendermint"
flagAddress = "address"
flagTransport = "transport"
flagTraceStore = "trace-store"
@@ -62,7 +61,6 @@ const (
FlagPruningKeepRecent = "pruning-keep-recent"
FlagPruningKeepEvery = "pruning-keep-every"
FlagPruningInterval = "pruning-interval"
FlagIndexEvents = "index-events"
FlagMinRetainBlocks = "min-retain-blocks"
)
@@ -114,9 +112,12 @@ which accepts a path for the resulting pprof file.
// Bind flags to the Context's Viper so the app construction can set
// options accordingly.
serverCtx.Viper.BindPFlags(cmd.Flags())
err := serverCtx.Viper.BindPFlags(cmd.Flags())
if err != nil {
return err
}
_, err := server.GetPruningOptionsFromFlags(serverCtx.Viper)
_, err = server.GetPruningOptionsFromFlags(serverCtx.Viper)
return err
},
RunE: func(cmd *cobra.Command, _ []string) error {
+8 -2
View File
@@ -28,8 +28,14 @@ import (
// to get the Tendermint configuration or to get access to Viper.
func InterceptConfigsPreRunHandler(cmd *cobra.Command) error {
rootViper := viper.New()
rootViper.BindPFlags(cmd.Flags())
rootViper.BindPFlags(cmd.PersistentFlags())
err := rootViper.BindPFlags(cmd.Flags())
if err != nil {
return err
}
err = rootViper.BindPFlags(cmd.PersistentFlags())
if err != nil {
return err
}
serverCtx := server.NewDefaultContext()
config, err := interceptConfigs(serverCtx, rootViper)