Skip to content

Commit

Permalink
Merge pull request #47 from initia-labs/feat/lint
Browse files Browse the repository at this point in the history
add golangci-lint config and fix err from lint
  • Loading branch information
Vritra4 authored Jul 5, 2024
2 parents 4c3d9d4 + 21817aa commit 549c754
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 30 deletions.
114 changes: 87 additions & 27 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,89 @@
linters:
disable-all: false
disable:
- thelper
- varnamelen
- tagliatelle
- interfacer
- wrapcheck
- deadcode
- exhaustivestruct
- golint
- ifshort
- maligned
- nosnakecase
- scopelint
- structcheck
- varcheck
linters-settings:
gocyclo:
min-complexity: 11
errcheck:
ignore: fmt:.*,io/ioutil:^Read.*,github.com/spf13/cobra:MarkFlagRequired,github.com/spf13/viper:BindPFlag
golint:
min-confidence: 1.1
enable:
- asciicheck
- bodyclose
- depguard
- dogsled
- dupl
- errcheck
- exportloopref
- goconst
- gofmt
- goimports
- gosec
- gosimple
- govet
- ineffassign
- misspell
# - nakedret
- nolintlint
# - prealloc
- staticcheck
# - structcheck // to be fixed by golangci-lint
- stylecheck
- typecheck
- unconvert
- unused

issues:
exclude:
- composite
run:
tests: false
exclude-rules:
- path: _test\.go
linters:
- gosec
- linters:
- stylecheck
text: "ST1003:"
max-same-issues: 50

linters-settings:
dogsled:
max-blank-identifiers: 3
#golint:
# min-confidence: 0
goconst:
ignore-tests: true
#maligned:
# suggest-new: true
misspell:
locale: US
depguard:
rules:
main:
files:
- $all
- "!$test"
allow:
- $gostd
- "cosmossdk.io/collections"
- "cosmossdk.io/core/address"
- "cosmossdk.io/core/store"
- "cosmossdk.io/log"
- "cosmossdk.io/store/cachekv"
- "cosmossdk.io/store/dbadapter"
- "cosmossdk.io/store/types"
- "github.com/cometbft/cometbft/abci/types"
- "github.com/cosmos/cosmos-db"
- "github.com/cosmos/cosmos-sdk/baseapp"
- "github.com/cosmos/cosmos-sdk/client"
- "github.com/cosmos/cosmos-sdk/codec"
- "github.com/cosmos/cosmos-sdk/server/types"
- "github.com/cosmos/cosmos-sdk/types"
- "github.com/cosmos/gogoproto/grpc"
- "github.com/grpc-ecosystem/grpc-gateway/runtime"
- "github.com/hashicorp/golang-lru"
- "github.com/initia-labs/kvindexer/config"
- "github.com/initia-labs/kvindexer/store"
- "github.com/initia-labs/kvindexer/store/goleveldb"
- "github.com/initia-labs/kvindexer/x/kvindexer/keeper"
- "github.com/initia-labs/kvindexer/x/kvindexer/types"
- "github.com/pkg/errors"
- "github.com/spf13/cast"
- "github.com/spf13/cobra"
- "github.com/spf13/viper"
- "github.com/syndtr/goleveldb/leveldb/filter"
- "github.com/syndtr/goleveldb/leveldb/opt"
test:
files:
- "$test"
allow:
- $gostd
6 changes: 3 additions & 3 deletions x/kvindexer/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ type AppModuleBasic struct {
keeper *keeper.Keeper
}

func (b AppModuleBasic) RegisterLegacyAminoCodec(amino *codec.LegacyAmino) { //nolint:staticcheck
/*nop*/ //types.RegisterLegacyAminoCodec(amino)
}
func (b AppModuleBasic) RegisterLegacyAminoCodec(amino *codec.LegacyAmino) {}

func (b AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, serveMux *runtime.ServeMux) {
err := types.RegisterQueryHandlerClient(context.Background(), serveMux, types.NewQueryClient(clientCtx))
Expand All @@ -48,6 +46,8 @@ func (b AppModuleBasic) RegisterInterfaces(registry cdctypes.InterfaceRegistry)
}

// Name returns the move module's name.
//
//nolint:stylecheck
func (AppModuleBasic) Name() string {
return types.ModuleName
}
Expand Down

0 comments on commit 549c754

Please sign in to comment.