diff --git a/.golangci.yml b/.golangci.yml index 9ea4a83fd..961a00e32 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -54,6 +54,8 @@ issues: # parameters and unchecked errors. - path: ^x/.+/module\.go$ linters: + - lll + - gci - revive - errcheck # Exclude cosmos-sdk module tx.go files as they are generated with unused @@ -83,6 +85,18 @@ issues: - path: errors\.go$ linters: - lll + # Exclude app module code as it's generated with lots with long lines and + # improperly formatted imports. + - path: ^app + linters: + - lll + - gci + # Exclude cmd directory code as it's generated with lots with long lines and + # improperly formatted imports. + - path: ^cmd/poc + linters: + - lll + - gci # TODO_IMPROVE: see https://golangci-lint.run/usage/configuration/#issues-configuration #new: true, #fix: true, diff --git a/x/application/types/genesis.go b/x/application/types/genesis.go index ce8046f53..cc16f8905 100644 --- a/x/application/types/genesis.go +++ b/x/application/types/genesis.go @@ -43,10 +43,18 @@ func (gs GenesisState) Validate() error { } stake, err := sdk.ParseCoinNormalized(app.Stake.String()) if !stake.IsValid() { - return sdkerrors.Wrapf(ErrAppInvalidStake, "invalid stake amount for application %v; (%v)", app.Stake, stake.Validate()) + return sdkerrors.Wrapf( + ErrAppInvalidStake, + "invalid stake amount for application %v; (%v)", + app.Stake, stake.Validate(), + ) } if err != nil { - return sdkerrors.Wrapf(ErrAppInvalidStake, "cannot parse stake amount for application %v; (%v)", app.Stake, err) + return sdkerrors.Wrapf( + ErrAppInvalidStake, + "cannot parse stake amount for application %v; (%v)", + app.Stake, err, + ) } if stake.IsZero() || stake.IsNegative() { return sdkerrors.Wrapf(ErrAppInvalidStake, "invalid stake amount for application: %v <= 0", app.Stake) @@ -58,7 +66,11 @@ func (gs GenesisState) Validate() error { // Check that the application's delegated gateway addresses are valid for _, gatewayAddr := range app.DelegateeGatewayAddresses { if _, err := sdk.AccAddressFromBech32(gatewayAddr); err != nil { - return sdkerrors.Wrapf(ErrAppInvalidGatewayAddress, "invalid gateway address %s; (%v)", gatewayAddr, err) + return sdkerrors.Wrapf( + ErrAppInvalidGatewayAddress, + "invalid gateway address %s; (%v)", + gatewayAddr, err, + ) } } diff --git a/x/gateway/module.go b/x/gateway/module.go index 7addaf6c0..61513b642 100644 --- a/x/gateway/module.go +++ b/x/gateway/module.go @@ -6,7 +6,7 @@ import ( "fmt" // this line is used by starport scaffolding # 1 - + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" diff --git a/x/gateway/types/genesis.go b/x/gateway/types/genesis.go index 5cb161252..43ab09ab7 100644 --- a/x/gateway/types/genesis.go +++ b/x/gateway/types/genesis.go @@ -35,10 +35,18 @@ func (gs GenesisState) Validate() error { } stake, err := sdk.ParseCoinNormalized(gateway.Stake.String()) if !stake.IsValid() { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount for gateway %v; (%v)", gateway.Stake, stake.Validate()) + return sdkerrors.Wrapf( + ErrGatewayInvalidStake, + "invalid stake amount for gateway %v; (%v)", + gateway.Stake, stake.Validate(), + ) } if err != nil { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "cannot parse stake amount for gateway %v; (%v)", gateway.Stake, err) + return sdkerrors.Wrapf( + ErrGatewayInvalidStake, + "cannot parse stake amount for gateway %v; (%v)", + gateway.Stake, err, + ) } if stake.IsZero() || stake.IsNegative() { return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount for gateway: %v <= 0", gateway.Stake) diff --git a/x/pocket/module.go b/x/pocket/module.go index 2a0e9d026..48b5c16eb 100644 --- a/x/pocket/module.go +++ b/x/pocket/module.go @@ -6,7 +6,7 @@ import ( "fmt" // this line is used by starport scaffolding # 1 - + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" diff --git a/x/supplier/module.go b/x/supplier/module.go index 1783cceca..a39dc9303 100644 --- a/x/supplier/module.go +++ b/x/supplier/module.go @@ -7,14 +7,16 @@ import ( // this line is used by starport scaffolding # 1 + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + abci "github.com/cometbft/cometbft/abci/types" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" "github.com/pokt-network/poktroll/x/supplier/client/cli" "github.com/pokt-network/poktroll/x/supplier/keeper" diff --git a/x/supplier/types/genesis.go b/x/supplier/types/genesis.go index 9d06b42ff..2772e4007 100644 --- a/x/supplier/types/genesis.go +++ b/x/supplier/types/genesis.go @@ -44,16 +44,32 @@ func (gs GenesisState) Validate() error { } stake, err := sdk.ParseCoinNormalized(supplier.Stake.String()) if !stake.IsValid() { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount for supplier %v; (%v)", supplier.Stake, stake.Validate()) + return sdkerrors.Wrapf( + ErrSupplierInvalidStake, + "invalid stake amount for supplier %v; (%v)", + supplier.Stake, stake.Validate(), + ) } if err != nil { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "cannot parse stake amount for supplier %v; (%v)", supplier.Stake, err) + return sdkerrors.Wrapf( + ErrSupplierInvalidStake, + "cannot parse stake amount for supplier %v; (%v)", + supplier.Stake, err, + ) } if stake.IsZero() || stake.IsNegative() { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount for supplier: %v <= 0", supplier.Stake) + return sdkerrors.Wrapf( + ErrSupplierInvalidStake, + "invalid stake amount for supplier: %v <= 0", + supplier.Stake, + ) } if stake.Denom != "upokt" { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount denom for supplier %v", supplier.Stake) + return sdkerrors.Wrapf( + ErrSupplierInvalidStake, + "invalid stake amount denom for supplier %v", + supplier.Stake, + ) } // Validate the application service configs