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

Update golangci-lint config #53

Merged
merged 1 commit into from
Jun 22, 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
33 changes: 24 additions & 9 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
linters-settings:
gci:
local-prefixes: github.com/ckaznocha/protoc-gen-lint
sections:
- standard
- default
- prefix(github.com/ckaznocha/protoc-gen-lint)
gocritic:
enabled-tags:
- diagnostic
Expand All @@ -10,10 +13,7 @@ linters-settings:
- style
goimports:
local-prefixes: github.com/ckaznocha/protoc-gen-lint
golint:
min-confidence: 0
govet:
check-shadowing: true
enable:
- asmdecl
- assign
Expand Down Expand Up @@ -54,52 +54,67 @@ linters:
disable-all: true
enable:
- asciicheck
- deadcode
- containedctx
- contextcheck
- copyloopvar
- cyclop
- dupl
- err113
- errcheck
- errname
- errorlint
- exhaustive
- exportloopref
- forcetypeassert
- funlen
- gci
- gocheckcompilerdirectives
- gochecknoglobals
- gochecknoinits
- gochecksumtype
- gocognit
- goconst
- gocritic
- gocyclo
- godot
- godox
- goerr113
- gofmt
- gofumpt
- goimports
- gomnd
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- intrange
- lll
- maintidx
- makezero
- mirror
- misspell
- mnd
- nakedret
- nestif
- nilerr
- nilnil
- nlreturn
- noctx
- nolintlint
- prealloc
- predeclared
- protogetter
- reassign
- revive
- rowserrcheck
- staticcheck
- structcheck
- stylecheck
- testableexamples
- typecheck
- unconvert
- unparam
- unused
- varcheck
- usestdlibvars
- wastedassign
- whitespace
- wrapcheck
- wsl
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/ckaznocha/protoc-gen-lint

go 1.11
go 1.22

require google.golang.org/protobuf v1.32.0
2 changes: 1 addition & 1 deletion linter/protoBufError.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (p *protoBufError) getSourceLineNumber(
// Started out using reflect.DeepEqual.
// This is more verbose but should be much faster.
if curLen == sourceLen {
for i := 0; i < sourceLen; i++ {
for i := range sourceLen {
if curPath[i] != p.path[i] {
skip = true

Expand Down
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@ func main() {
gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL)

totalErrors := 0

for _, f := range gen.Files {
numErrors, err := linter.LintProtoFile(linter.Config{
ProtoFile: f.Proto,
OutFile: os.Stderr,
SortImports: *sortImports,
})
if err != nil {
return err
return fmt.Errorf("failed to lint proto file %s: %w", f.Proto.GetName(), err)
}

totalErrors += numErrors
Expand Down
1 change: 1 addition & 0 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# google.golang.org/protobuf v1.32.0
## explicit; go 1.17
google.golang.org/protobuf/compiler/protogen
google.golang.org/protobuf/encoding/prototext
google.golang.org/protobuf/encoding/protowire
Expand Down
Loading