Skip to content

Commit

Permalink
configure super linter (evmos#846)
Browse files Browse the repository at this point in the history
  • Loading branch information
faddat authored Aug 15, 2022
1 parent afbd97e commit 7e9972d
Show file tree
Hide file tree
Showing 17 changed files with 114 additions and 70 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
# You can adjust the behavior by modifying this file.
# For more information, see:
# https://github.com/github/super-linter
---
name: Lint Code Base

on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "main" ]
branches: ["main"]
jobs:
run-lint:
runs-on: ubuntu-latest
Expand All @@ -24,6 +25,13 @@ jobs:
- name: Lint Code Base
uses: github/super-linter@v4
env:
LINTER_RULES_PATH: /
YAML_CONFIG_FILE: .yamllint
VALIDATE_ALL_CODEBASE: false
MARKDOWN_CONFIG_FILE: .markdownlint.yml
VALIDATE_NATURAL_LANGUAGE: false
VALIDATE_OPENAPI: false
VALIDATE_JSCPD: false
VALIDATE_GO: false
DEFAULT_BRANCH: "main"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9 changes: 5 additions & 4 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
"default": true
"MD001": false
"MD004": false
"MD007":
"MD007":
"indent": 4
"MD013": false
"MD024":
"MD024":
"siblings_only": true
"MD025": false
"MD026":
"MD026":
"punctuation": ".;:"
"MD029": false
"MD033": false
"MD034": false
"MD036": false
"MD040": false
"MD041": false
"MD049":
"MD051": false
"MD049":
"style": "asterisk"
"no-hard-tabs": false
31 changes: 31 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---

yaml-files:
- '*.yaml'
- '*.yml'
- '.yamllint'

rules:
braces: enable
brackets: enable
colons: enable
commas: enable
comments:
level: warning
comments-indentation: disable
document-end: disable
document-start: disable
empty-lines: disable
empty-values: disable
float-values: disable
hyphens: enable
indentation: enable
key-duplicates: enable
key-ordering: disable
line-length: disable
new-line-at-end-of-file: enable
new-lines: enable
octal-values: disable
quoted-strings: disable
trailing-spaces: disable
truthy: disable
3 changes: 2 additions & 1 deletion app/ante/doc.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*Package ante defines the SDK auth module's AnteHandler as well as an internal
/*
Package ante defines the SDK auth module's AnteHandler as well as an internal
AnteHandler for an Ethereum transaction (i.e MsgEthereumTx).
During CheckTx, the transaction is passed through a series of
Expand Down
10 changes: 5 additions & 5 deletions app/ante/vesting.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ func NewEthVestingTransactionDecorator(ak evmtypes.AccountKeeper) EthVestingTran
// vesting cliff and lockup period.
//
// This AnteHandler decorator will fail if:
// - the message is not a MsgEthereumTx
// - sender account cannot be found
// - sender account is not a ClawbackvestingAccount
// - blocktime is before surpassing vesting cliff end (with zero vested coins) AND
// - blocktime is before surpassing all lockup periods (with non-zero locked coins)
// - the message is not a MsgEthereumTx
// - sender account cannot be found
// - sender account is not a ClawbackvestingAccount
// - blocktime is before surpassing vesting cliff end (with zero vested coins) AND
// - blocktime is before surpassing all lockup periods (with non-zero locked coins)
func (vtd EthVestingTransactionDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) {
for _, msg := range tx.GetMsgs() {
msgEthTx, ok := msg.(*evmtypes.MsgEthereumTx)
Expand Down
3 changes: 2 additions & 1 deletion app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ func (app *Evmos) ExportAppStateAndValidators(

// prepare for fresh start at zero height
// NOTE zero height genesis is a temporary feature which will be deprecated
// in favor of export at a block height
//
// in favor of export at a block height
func (app *Evmos) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) error {
applyAllowedAddrs := false

Expand Down
4 changes: 2 additions & 2 deletions app/forks.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
//
// CONTRACT: for this logic to work properly it is required to:
//
// 1) Release a non-breaking patch version so that the chain can set the scheduled upgrade plan at upgrade-height.
// 2) Release the software defined in the upgrade-info
// 1. Release a non-breaking patch version so that the chain can set the scheduled upgrade plan at upgrade-height.
// 2. Release the software defined in the upgrade-info
func (app *Evmos) ScheduleForkUpgrade(ctx sdk.Context) {
// NOTE: there are no testnet forks for the existing versions
if !types.IsMainnet(ctx.ChainID()) {
Expand Down
6 changes: 2 additions & 4 deletions client/docs/statik/statik.go

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions ibc/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import (
// GetTransferSenderRecipient returns the sender and recipient sdk.AccAddresses
// from an ICS20 FungibleTokenPacketData as well as the original sender bech32
// address from the packet data. This function fails if:
// - the packet data is not FungibleTokenPacketData
// - sender address is invalid
// - recipient address is invalid
// - the packet data is not FungibleTokenPacketData
// - sender address is invalid
// - recipient address is invalid
func GetTransferSenderRecipient(packet channeltypes.Packet) (
sender, recipient sdk.AccAddress,
senderBech32, recipientBech32 string,
Expand Down
4 changes: 2 additions & 2 deletions x/claims/keeper/claim.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ func (k Keeper) ClaimCoinsForAction(
// from both records.

// This method additionally:
// - Always claims the IBC action, assuming both record haven't claimed it.
// - Marks an action as claimed for the new instance by performing an XOR operation between the 2 provided records: `merged completed action = sender completed action XOR recipient completed action`
// - Always claims the IBC action, assuming both record haven't claimed it.
// - Marks an action as claimed for the new instance by performing an XOR operation between the 2 provided records: `merged completed action = sender completed action XOR recipient completed action`
func (k Keeper) MergeClaimsRecords(
ctx sdk.Context,
recipient sdk.AccAddress,
Expand Down
4 changes: 2 additions & 2 deletions x/erc20/keeper/evm_hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ func (h Hooks) PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *etht
// the module account address. This hook applies to both token pairs that have
// been registered through a native Cosmos coin or an ERC20 token. If token pair
// has been registered with:
// - coin -> burn tokens and transfer escrowed coins on module to sender
// - token -> escrow tokens on module account and mint & transfer coins to sender
// - coin -> burn tokens and transfer escrowed coins on module to sender
// - token -> escrow tokens on module account and mint & transfer coins to sender
//
// Note that the PostTxProcessing hook is only called by sending an EVM
// transaction that triggers `ApplyTransaction`. A cosmos tx with a
Expand Down
8 changes: 4 additions & 4 deletions x/erc20/keeper/mint.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
)

// MintingEnabled checks that:
// - the global parameter for erc20 conversion is enabled
// - minting is enabled for the given (erc20,coin) token pair
// - recipient address is not on the blocked list
// - bank module transfers are enabled for the Cosmos coin
// - the global parameter for erc20 conversion is enabled
// - minting is enabled for the given (erc20,coin) token pair
// - recipient address is not on the blocked list
// - bank module transfers are enabled for the Cosmos coin
func (k Keeper) MintingEnabled(
ctx sdk.Context,
sender, receiver sdk.AccAddress,
Expand Down
36 changes: 18 additions & 18 deletions x/erc20/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ func (k Keeper) ConvertERC20(

// convertCoinNativeCoin handles the coin conversion for a native Cosmos coin
// token pair:
// - escrow coins on module account
// - mint tokens and send to receiver
// - check if token balance increased by amount
// - escrow coins on module account
// - mint tokens and send to receiver
// - check if token balance increased by amount
func (k Keeper) convertCoinNativeCoin(
ctx sdk.Context,
pair types.TokenPair,
Expand Down Expand Up @@ -188,10 +188,10 @@ func (k Keeper) convertCoinNativeCoin(

// convertERC20NativeCoin handles the erc20 conversion for a native Cosmos coin
// token pair:
// - burn escrowed tokens
// - unescrow coins that have been previously escrowed with ConvertCoin
// - check if coin balance increased by amount
// - check if token balance decreased by amount
// - burn escrowed tokens
// - unescrow coins that have been previously escrowed with ConvertCoin
// - check if coin balance increased by amount
// - check if token balance decreased by amount
func (k Keeper) convertERC20NativeCoin(
ctx sdk.Context,
pair types.TokenPair,
Expand Down Expand Up @@ -288,12 +288,12 @@ func (k Keeper) convertERC20NativeCoin(

// convertERC20NativeToken handles the erc20 conversion for a native erc20 token
// pair:
// - escrow tokens on module account
// - mint coins on bank module
// - send minted coins to the receiver
// - check if coin balance increased by amount
// - check if token balance decreased by amount
// - check for unexpected `Approval` event in logs
// - escrow tokens on module account
// - mint coins on bank module
// - send minted coins to the receiver
// - check if coin balance increased by amount
// - check if token balance decreased by amount
// - check for unexpected `Approval` event in logs
func (k Keeper) convertERC20NativeToken(
ctx sdk.Context,
pair types.TokenPair,
Expand Down Expand Up @@ -416,11 +416,11 @@ func (k Keeper) convertERC20NativeToken(

// convertCoinNativeERC20 handles the coin conversion for a native ERC20 token
// pair:
// - escrow Coins on module account
// - unescrow Tokens that have been previously escrowed with ConvertERC20 and send to receiver
// - burn escrowed Coins
// - check if token balance increased by amount
// - check for unexpected `Approval` event in logs
// - escrow Coins on module account
// - unescrow Tokens that have been previously escrowed with ConvertERC20 and send to receiver
// - burn escrowed Coins
// - check if token balance increased by amount
// - check for unexpected `Approval` event in logs
func (k Keeper) convertCoinNativeERC20(
ctx sdk.Context,
pair types.TokenPair,
Expand Down
3 changes: 2 additions & 1 deletion x/erc20/types/erc20.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions x/incentives/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import (
)

// NewRegisterIncentiveProposalCmd implements the command to submit a register
// incentive proposal
//
// incentive proposal
func NewRegisterIncentiveProposalCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "register-incentive [contract-address] [allocation] [epochs]",
Expand Down Expand Up @@ -100,7 +101,8 @@ func NewRegisterIncentiveProposalCmd() *cobra.Command {
}

// NewCancelIncentiveProposalCmd implements the command to submit a cancel
// incentive proposal
//
// incentive proposal
func NewCancelIncentiveProposalCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "cancel-incentive [contract-address]",
Expand Down
26 changes: 13 additions & 13 deletions x/incentives/keeper/distribution.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import (

// DistributeRewards transfers the allocated rewards to the participants of a given
// incentive.
// - allocates the amount to be distributed from the inflation pool
// - distributes the rewards to all participants
// - deletes all gas meters
// - updates the remaining epochs of each incentive
// - sets the cumulative totalGas to zero
// - allocates the amount to be distributed from the inflation pool
// - distributes the rewards to all participants
// - deletes all gas meters
// - updates the remaining epochs of each incentive
// - sets the cumulative totalGas to zero
func (k Keeper) DistributeRewards(ctx sdk.Context) error {
logger := k.Logger(ctx)

Expand Down Expand Up @@ -87,9 +87,9 @@ func (k Keeper) DistributeRewards(ctx sdk.Context) error {
}

// rewardAllocations returns a map of each incentive's reward allocation
// - Iterate over all the registered and active incentives
// - create an allocation (module account) from escrow balance to be distributed to the contract address
// - check that escrow balance is sufficient
// - Iterate over all the registered and active incentives
// - create an allocation (module account) from escrow balance to be distributed to the contract address
// - check that escrow balance is sufficient
func (k Keeper) rewardAllocations(
ctx sdk.Context,
) (map[common.Address]sdk.Coins, sdk.Coins, error) {
Expand Down Expand Up @@ -162,11 +162,11 @@ func (k Keeper) rewardAllocations(

// rewardParticipants reward participants of a given Incentive, delete their gas
// meters and returns a count of all gas meters
// - Check if participants spent gas on interacting with incentive
// - Iterate over the incentive participants' gas meters
// - Allocate rewards according to participants gasRatio and cap them at 100% of their gas spent on interaction with incentive
// - Send rewards to participants
// - Delete gas meter
// - Check if participants spent gas on interacting with incentive
// - Iterate over the incentive participants' gas meters
// - Allocate rewards according to participants gasRatio and cap them at 100% of their gas spent on interaction with incentive
// - Send rewards to participants
// - Delete gas meter
func (k Keeper) rewardParticipants(
ctx sdk.Context,
incentive types.Incentive,
Expand Down
13 changes: 7 additions & 6 deletions x/recovery/keeper/ibc_callbacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ import (
// ethsecp256k1 address. The expected behavior is as follows:
//
// First transfer from authorized source chain:
// - sends back IBC tokens which originated from the source chain
// - sends over all Evmos native tokens
// - sends back IBC tokens which originated from the source chain
// - sends over all Evmos native tokens
//
// Second transfer from a different authorized source chain:
// - only sends back IBC tokens which originated from the source chain
// - only sends back IBC tokens which originated from the source chain
func (k Keeper) OnRecvPacket(
ctx sdk.Context,
packet channeltypes.Packet,
Expand Down Expand Up @@ -225,9 +226,9 @@ func (k Keeper) OnRecvPacket(
// GetIBCDenomDestinationIdentifiers returns the destination port and channel of
// the IBC denomination, i.e port and channel on Evmos for the voucher. It
// returns an error if:
// - the denomination is invalid
// - the denom trace is not found on the store
// - destination port or channel ID are invalid
// - the denomination is invalid
// - the denom trace is not found on the store
// - destination port or channel ID are invalid
func (k Keeper) GetIBCDenomDestinationIdentifiers(ctx sdk.Context, denom, sender string) (destinationPort, destinationChannel string, err error) {
ibcDenom := strings.SplitN(denom, "/", 2)
if len(ibcDenom) < 2 {
Expand Down

0 comments on commit 7e9972d

Please sign in to comment.