Skip to content

Commit

Permalink
chore: Fix lint (#341)
Browse files Browse the repository at this point in the history
- nolint now can not have whitespaces
- The new golint version requires go 1.19, So only at that workflow go 1.19 is going to be used
  • Loading branch information
RafilxTenfen authored Aug 9, 2022
1 parent 16f0f50 commit 344e0b9
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 740 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.17
go-version: 1.19
- uses: technote-space/[email protected]
with:
PATTERNS: |
Expand Down
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ run:
skip-dirs:
- test
- diagrams
go: '1.19'

govet:
# Enable analyzers by name (in addition to default).
Expand Down Expand Up @@ -67,6 +68,7 @@ linters-settings:
locale: US
nolintlint:
allow-unused: false
# Disable to ensure that nolint directives don't have a leading space. Default is true.
allow-leading-space: true
require-explanation: false
require-specific: false
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

[#275](https://github.com/umee-network/peggo/pull/275) Add diagrams of main loops.
[#297](https://github.com/umee-network/peggo/pull/297) Update dependabot reviewers.
[#341](https://github.com/umee-network/peggo/pull/341) Fix linter.

### Bug Fixes

Expand Down
2 changes: 1 addition & 1 deletion cmd/peggo/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
)

var (
// nolint: lll
//nolint: lll
maxUint256 = new(big.Int).SetBytes(ethcmn.Hex2Bytes("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"))
halfMaxUint256 = new(big.Int).Div(maxUint256, big.NewInt(2))
)
Expand Down
10 changes: 5 additions & 5 deletions cmd/peggo/flags.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// nolint: lll
package peggo

import (
Expand Down Expand Up @@ -72,7 +71,7 @@ func cosmosKeyringFlagSet() *pflag.FlagSet {
fs.String(flagCosmosKeyring, keyring.BackendFile, "Specify Cosmos keyring backend (os|file|kwallet|pass|test)")
fs.String(flagCosmosKeyringDir, "", "Specify Cosmos keyring directory, if using file keyring")
fs.String(flagCosmosKeyringApp, "peggo", "Specify Cosmos keyring app name")
fs.String(flagCosmosFrom, "", "Specify the Cosmos orchestrator key name or address. If specified, must exist in keyring, ledger or match the privkey")
fs.String(flagCosmosFrom, "", "Specify the Cosmos orchestrator key name or address. If specified, must exist in keyring, ledger or match the privkey") //nolint: lll
fs.String(flagCosmosFromPassphrase, "", "Specify the keyring passphrase, otherwise STDIN will be used")
fs.String(flagCosmosPK, "", "Specify a Cosmos account private key of the orchestrator in hex")
fs.Bool(flagCosmosUseLedger, false, "Use the Cosmos app on a hardware ledger to sign transactions")
Expand All @@ -86,8 +85,9 @@ func ethereumKeyOptsFlagSet() *pflag.FlagSet {
fs := pflag.NewFlagSet("", pflag.ContinueOnError)

fs.String(flagEthKeystoreDir, "", "Specify the Ethereum keystore directory (Geth-format) prefix")
fs.String(flagEthFrom, "", "Specify the Ethereum from address; If specified, it must exist in the keystore, ledger or match the privkey")
fs.String(flagEthPassphrase, "", "Specify the passphrase to unlock the private key from armor; If empty then STDIN is used")
fs.String(flagEthFrom, "", "Specify the Ethereum from address; If specified, it must exist in the keystore, ledger or match the privkey") //nolint: lll
fs.String(flagEthPassphrase, "", "Specify the passphrase to unlock the private key from armor; If empty then STDIN is used") //nolint: lll

fs.Bool(flagEthUseLedger, false, "Use the Ethereum app on hardware ledger to sign transactions")
return fs
}
Expand All @@ -106,7 +106,7 @@ func bridgeFlagSet() *pflag.FlagSet {
fs := pflag.NewFlagSet("", pflag.ContinueOnError)

fs.String(flagEthRPC, "http://localhost:8545", "Specify the RPC address of an Ethereum node")
fs.Int64(flagEthGasPrice, 0, "The Ethereum gas price (in wei) to include in the transaction; If zero, gas price will be estimated")
fs.Int64(flagEthGasPrice, 0, "The Ethereum gas price (in wei) to include in the transaction; If zero, gas price will be estimated") //nolint: lll
fs.Int64(flagEthGasLimit, 6000000, "The Ethereum gas limit to include in the transaction")

return fs
Expand Down
8 changes: 4 additions & 4 deletions cmd/peggo/orchestrator.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// nolint: lll
package peggo

import (
Expand Down Expand Up @@ -274,19 +273,20 @@ func getOrchestratorCmd() *cobra.Command {
},
}

cmd.Flags().String(flagValsetRelayMode, relayer.ValsetRelayModeNone.String(), "Set an (optional) relaying mode for valset updates to Ethereum. Possible values: none, minimum, all")
cmd.Flags().String(flagValsetRelayMode, relayer.ValsetRelayModeNone.String(), "Set an (optional) relaying mode for valset updates to Ethereum. Possible values: none, minimum, all") //nolint: lll
cmd.Flags().Bool(flagRelayBatches, false, "Relay transaction batches to Ethereum")
cmd.Flags().Int64(flagEthBlocksPerLoop, 2000, "Number of Ethereum blocks to process per orchestrator loop")
cmd.Flags().String(flagCoinGeckoAPI, "https://api.coingecko.com/api/v3", "Specify the coingecko API endpoint")
//nolint: lll
cmd.Flags().StringSlice(flagOracleProviders, []string{umeedpfconfig.ProviderBinance, umeedpfconfig.ProviderHuobi},
fmt.Sprintf("Specify the providers to use in the oracle, options \"%s\"", strings.Join([]string{umeedpfconfig.ProviderBinance, umeedpfconfig.ProviderHuobi,
umeedpfconfig.ProviderKraken, umeedpfconfig.ProviderGate, umeedpfconfig.ProviderOkx, umeedpfconfig.ProviderOsmosis}, ",")))
cmd.Flags().Duration(flagEthPendingTXWait, 20*time.Minute, "Time for a pending tx to be considered stale")
cmd.Flags().String(flagEthAlchemyWS, "", "Specify the Alchemy websocket endpoint")
cmd.Flags().Float64(flagProfitMultiplier, 1.0, "Multiplier to apply to relayer profit")
cmd.Flags().Float64(flagRelayerLoopMultiplier, 3.0, "Multiplier for the relayer loop duration (in ETH blocks)")
cmd.Flags().Float64(flagRequesterLoopMultiplier, 60.0, "Multiplier for the batch requester loop duration (in Cosmos blocks)")
cmd.Flags().String(flagCosmosFeeGranter, "", "Set an (optional) fee granter address that will pay for Cosmos fees (feegrant must exist)")
cmd.Flags().Float64(flagRequesterLoopMultiplier, 60.0, "Multiplier for the batch requester loop duration (in Cosmos blocks)") //nolint: lll
cmd.Flags().String(flagCosmosFeeGranter, "", "Set an (optional) fee granter address that will pay for Cosmos fees (feegrant must exist)") //nolint: lll
cmd.Flags().Int64(flagBridgeStartHeight, 0, "Set an (optional) height to wait for the bridge to be available")
cmd.Flags().Int(flagCosmosMsgsPerTx, 10, "Set a maximum number of messages to send per transaction (used for claims)")
cmd.Flags().AddFlagSet(cosmosFlagSet())
Expand Down
3 changes: 1 addition & 2 deletions cmd/peggo/peggo.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// nolint: lll
package peggo

import (
Expand Down Expand Up @@ -27,7 +26,7 @@ flag (e.g. PEGGO_COSMOS_PK).`,

cmd.PersistentFlags().String(flagLogLevel, zerolog.InfoLevel.String(), "logging level")
cmd.PersistentFlags().String(flagLogFormat, logLevelText, "logging format (text|json)")
cmd.PersistentFlags().String(flagSvcWaitTimeout, "1m", "Standard wait timeout for external services (e.g. Cosmos daemon gRPC connection)")
cmd.PersistentFlags().String(flagSvcWaitTimeout, "1m", "Standard wait timeout for external services (e.g. Cosmos daemon gRPC connection)") //nolint: lll

cmd.AddCommand(
getOrchestratorCmd(),
Expand Down
Loading

0 comments on commit 344e0b9

Please sign in to comment.