fix lint errors

This commit is contained in:
0xmuralik 2023-01-06 11:24:50 +05:30
parent be3d3b7093
commit c729fb73c1
7 changed files with 29 additions and 31 deletions

View File

@ -33,25 +33,7 @@ jobs:
github-token: ${{ secrets.github_token }}
# Check only if there are differences in the source code
if: env.GIT_DIFF
markdown-lint:
name: Run markdown-lint
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: technote-space/get-diff-action@v6.1.2
with:
PATTERNS: |
docs/**/*.md
x/**/*.md
README.md
- uses: nosborn/github-action-markdown-cli@v3.2.0
with:
files: .
config_file: .markdownlint.yml
ignore_path: .markdownlintignore
# Check only if there are differences in the source code
if: env.GIT_DIFF
python-lint:
name: Run flake8 on python integration tests
runs-on: ubuntu-latest
@ -68,6 +50,7 @@ jobs:
- run: |
nix-shell -I nixpkgs=./nix -p test-env --run "make lint-py"
if: env.GIT_DIFF
gomod2nix:
name: Check gomod2nix.toml file is up to date
runs-on: ubuntu-latest

View File

@ -3,7 +3,7 @@ package cli
import (
"encoding/hex"
"fmt"
"io/ioutil"
"os"
"time"
"github.com/cosmos/cosmos-sdk/client"
@ -134,7 +134,7 @@ func GetCmdCommitBid() *cobra.Command {
}
// Save reveal file.
err = ioutil.WriteFile(fmt.Sprintf("%s-%s.json", clientCtx.GetFromName(), commitHash), content, 0o600)
err = os.WriteFile(fmt.Sprintf("%s-%s.json", clientCtx.GetFromName(), commitHash), content, 0o600)
if err != nil {
return err
}
@ -169,7 +169,7 @@ func GetCmdRevealBid() *cobra.Command {
auctionID := args[0]
revealFilePath := args[1]
revealBytes, err := ioutil.ReadFile(revealFilePath) // #nosec G304
revealBytes, err := os.ReadFile(revealFilePath) // #nosec G304
if err != nil {
return err
}

View File

@ -58,7 +58,12 @@ type AuctionClientKeeper interface {
}
// NewKeeper creates new instances of the auction Keeper
func NewKeeper(accountKeeper auth.AccountKeeper, bankKeeper bank.Keeper, storeKey storetypes.StoreKey, cdc codec.BinaryCodec, ps params.Subspace) Keeper {
func NewKeeper(accountKeeper auth.AccountKeeper,
bankKeeper bank.Keeper,
storeKey storetypes.StoreKey,
cdc codec.BinaryCodec,
ps params.Subspace,
) Keeper {
if !ps.HasKeyTable() {
ps = ps.WithKeyTable(types.ParamKeyTable())
}
@ -585,11 +590,9 @@ func (k Keeper) pickAuctionWinner(ctx sdk.Context, auction *types.Auction) {
if secondHighestBid != nil {
auction.WinningPrice = secondHighestBid.BidAmount
}
ctx.Logger().Info(fmt.Sprintf("Auction %s winner %s.", auction.Id, auction.WinnerAddress))
ctx.Logger().Info(fmt.Sprintf("Auction %s winner bid %s.", auction.Id, auction.WinningBid.String()))
ctx.Logger().Info(fmt.Sprintf("Auction %s winner price %s.", auction.Id, auction.WinningPrice.String()))
} else {
ctx.Logger().Info(fmt.Sprintf("Auction %s has no valid revealed bids (no winner).", auction.Id))
}

View File

@ -46,7 +46,9 @@ func (q Querier) GetBondsByOwner(c context.Context, req *types.QueryGetBondsByOw
return &types.QueryGetBondsByOwnerResponse{Bonds: bonds}, nil
}
func (q Querier) GetBondsModuleBalance(c context.Context, _ *types.QueryGetBondModuleBalanceRequest) (*types.QueryGetBondModuleBalanceResponse, error) {
func (q Querier) GetBondsModuleBalance(c context.Context,
_ *types.QueryGetBondModuleBalanceRequest,
) (*types.QueryGetBondModuleBalanceResponse, error) {
ctx := sdk.UnwrapSDKContext(c)
balance := q.Keeper.GetBondModuleBalances(ctx)
return &types.QueryGetBondModuleBalanceResponse{Balance: balance}, nil

View File

@ -39,7 +39,13 @@ type Keeper struct {
}
// NewKeeper creates new instances of the bond Keeper
func NewKeeper(cdc codec.BinaryCodec, accountKeeper auth.AccountKeeper, bankKeeper bank.Keeper, usageKeepers []types.BondUsageKeeper, storeKey storetypes.StoreKey, ps paramtypes.Subspace) Keeper {
func NewKeeper(cdc codec.BinaryCodec,
accountKeeper auth.AccountKeeper,
bankKeeper bank.Keeper,
usageKeepers []types.BondUsageKeeper,
storeKey storetypes.StoreKey,
ps paramtypes.Subspace,
) Keeper {
// set KeyTable if it has not already been set
if !ps.HasKeyTable() {
ps = ps.WithKeyTable(types.ParamKeyTable())

View File

@ -2,7 +2,7 @@ package cli
import (
"fmt"
"io/ioutil"
"os"
"strings"
"github.com/cerc-io/laconicd/server/flags"
@ -380,7 +380,7 @@ $ %s tx %s delete-name [crn]
func GetPayloadFromFile(filePath string) (*types.PayloadType, error) {
var payload types.PayloadType
data, err := ioutil.ReadFile(filePath) // #nosec G304
data, err := os.ReadFile(filePath) // #nosec G304
if err != nil {
return nil, err
}

View File

@ -60,7 +60,9 @@ func (q Querier) GetRecordByBondID(c context.Context, req *types.QueryRecordByBo
return &types.QueryRecordByBondIDResponse{Records: records}, nil
}
func (q Querier) GetRegistryModuleBalance(c context.Context, _ *types.GetRegistryModuleBalanceRequest) (*types.GetRegistryModuleBalanceResponse, error) {
func (q Querier) GetRegistryModuleBalance(c context.Context,
_ *types.GetRegistryModuleBalanceRequest,
) (*types.GetRegistryModuleBalanceResponse, error) {
ctx := sdk.UnwrapSDKContext(c)
balances := q.Keeper.GetModuleBalances(ctx)
return &types.GetRegistryModuleBalanceResponse{
@ -109,7 +111,9 @@ func (q Querier) GetRecordExpiryQueue(c context.Context, _ *types.QueryGetRecord
return &types.QueryGetRecordExpiryQueueResponse{Records: records}, nil
}
func (q Querier) GetAuthorityExpiryQueue(c context.Context, _ *types.QueryGetAuthorityExpiryQueue) (*types.QueryGetAuthorityExpiryQueueResponse, error) {
func (q Querier) GetAuthorityExpiryQueue(c context.Context,
_ *types.QueryGetAuthorityExpiryQueue,
) (*types.QueryGetAuthorityExpiryQueueResponse, error) {
ctx := sdk.UnwrapSDKContext(c)
authorities := q.Keeper.GetAuthorityExpiryQueue(ctx)
return &types.QueryGetAuthorityExpiryQueueResponse{Authorities: authorities}, nil