Skip to content

Commit

Permalink
Update golangci-lint config (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
ckaznocha committed Jun 22, 2024
1 parent d394eb4 commit a06592a
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 12 deletions.
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

0 comments on commit a06592a

Please sign in to comment.