Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add golangci-lint config and fix err from lint #47

Merged
merged 1 commit into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading