Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
atheeshp committed Feb 16, 2024
1 parent 88c1b96 commit 2cea141
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 25 deletions.
18 changes: 12 additions & 6 deletions .github/linters/.golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ linters:
enable:
- bodyclose
- depguard
- depguard:
- depguard
- dogsled
- errcheck
- exportloopref
Expand Down Expand Up @@ -67,8 +67,14 @@ linters-settings:
initialisms: ["ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON", "QPS", "RAM", "RPC", "SLA", "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "GID", "UID", "UUID", "URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS", "SIP", "RTP", "AMQP", "DB", "TS"]

depguard:
list-type: whitelist
packages:
- cosmossdk.io/errors
- filippo.io/edwards25519
include-go-root: false
rules:
main:
files:
- $all
list-mode: lax
allow: "*"

goconst:
min-occurrences: 5
ignore-tests: true
ignore-strings: "echo '"
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.56.1
version: v1.56.2
args: --config .github/linters/.golangci.yaml

proto-lint:
Expand Down
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,17 @@ generate:
### Lint / Format ###
###############################################################################


golangci_version=v1.56.2

lint:
golangci-lint run --out-format=tab
@echo "--> Running linter"
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
golangci-lint run --out-format=tab --config .github/linters/.golangci.yaml

lint-fix:
golangci-lint run --fix --out-format=tab --issues-exit-code=0
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
golangci-lint run --config .github/linters/.golangci.yaml --fix --out-format=tab --issues-exit-code=0

format_filter = -name '*.go' -type f \
-not -path '*.git*' \
Expand Down
11 changes: 5 additions & 6 deletions ante/testutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/stretchr/testify/suite"

"github.com/cheqd/cheqd-node/app"
cheqdapp "github.com/cheqd/cheqd-node/app"
didtypes "github.com/cheqd/cheqd-node/x/did/types"
resourcetypes "github.com/cheqd/cheqd-node/x/resource/types"
Expand All @@ -34,16 +33,16 @@ type TestAccount struct {
type AnteTestSuite struct {
suite.Suite

app *app.TestApp
app *cheqdapp.TestApp
anteHandler sdk.AnteHandler
ctx sdk.Context
clientCtx client.Context
txBuilder client.TxBuilder
}

// returns context and app with params set on account keeper
func createTestApp(isCheckTx bool) (*app.TestApp, sdk.Context, error) {
app, err := app.Setup(isCheckTx)
func createTestApp(isCheckTx bool) (*cheqdapp.TestApp, sdk.Context, error) {
app, err := cheqdapp.Setup(isCheckTx)
if err != nil {
return nil, sdk.Context{}, err
}
Expand Down Expand Up @@ -79,8 +78,8 @@ func (s *AnteTestSuite) SetupTest(isCheckTx bool) error {
s.clientCtx = client.Context{}.
WithTxConfig(encodingConfig.TxConfig)

anteHandler, err := app.NewAnteHandler(
app.HandlerOptions{
anteHandler, err := cheqdapp.NewAnteHandler(
cheqdapp.HandlerOptions{
AccountKeeper: s.app.AccountKeeper,
BankKeeper: s.app.BankKeeper,
FeegrantKeeper: s.app.FeeGrantKeeper,
Expand Down
8 changes: 4 additions & 4 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -831,8 +831,8 @@ func (app *App) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.Res
}

// RegisterNodeService registers the node gRPC service on the app gRPC router.
func (a *App) RegisterNodeService(clientCtx client.Context) {
nodeservice.RegisterNodeService(clientCtx, a.GRPCQueryRouter())
func (app *App) RegisterNodeService(clientCtx client.Context) {
nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter())
}

// SimulationManager implements the SimulationApp interface.
Expand Down Expand Up @@ -1175,6 +1175,6 @@ func (app *App) RegisterUpgradeHandlers() {
)
}

func (a *App) Configurator() module.Configurator {
return a.configurator
func (app *App) Configurator() module.Configurator {
return app.configurator
}
4 changes: 2 additions & 2 deletions cmd/cheqd-noded/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) {
func genesisCommand(encodingConfig params.EncodingConfig, cmds ...*cobra.Command) *cobra.Command {
cmd := genutilcli.GenesisCoreCommand(encodingConfig.TxConfig, app.ModuleBasics, app.DefaultNodeHome)

for _, sub_cmd := range cmds {
cmd.AddCommand(sub_cmd)
for _, subCmd := range cmds {
cmd.AddCommand(subCmd)
}
return cmd
}
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/helpers/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ func ReadableEvents(events []types.Event) []HumanReadableEvent {
readableAttributes := make([]HumanReadableEventAttribute, len(event.Attributes))
for i, attribute := range event.Attributes {
readableAttributes[i] = HumanReadableEventAttribute{
Key: string(attribute.Key),
Value: string(attribute.Value),
Key: attribute.Key,
Value: attribute.Value,
Index: attribute.Index,
}
}
Expand Down
3 changes: 1 addition & 2 deletions x/resource/keeper/keeper_param_change_proposal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (

tmproto "github.com/cometbft/cometbft/proto/tendermint/types"

"github.com/cheqd/cheqd-node/app"
cheqdapp "github.com/cheqd/cheqd-node/app"
resourcetypes "github.com/cheqd/cheqd-node/x/resource/types"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand All @@ -20,7 +19,7 @@ import (
type HandlerTestSuite struct {
suite.Suite

app *app.TestApp
app *cheqdapp.TestApp
ctx sdk.Context
govHandler govv1beta1.Handler
}
Expand Down

0 comments on commit 2cea141

Please sign in to comment.