From 87d55d9c0849e37a914c1c88e34d9ce2264ddf5e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Jan 2024 16:12:26 +0100 Subject: [PATCH] build(deps): bump github.com/go-critic/go-critic from 0.10.0 to 0.11.0 (#4295) Co-authored-by: Fernandez Ludovic --- .golangci.reference.yml | 10 +++++++++- go.mod | 2 +- go.sum | 4 ++-- pkg/golinters/mirror.go | 2 +- pkg/golinters/nolintlint/nolintlint.go | 6 +++--- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.golangci.reference.yml b/.golangci.reference.yml index f24a96ad6915..4b219ee882c4 100644 --- a/.golangci.reference.yml +++ b/.golangci.reference.yml @@ -565,6 +565,10 @@ linters-settings: # Whether to restrict checker to params only. # Default: true paramsOnly: false + commentedOutCode: + # Min length of the comment that triggers a warning. + # Default: 15 + minLength: 50 elseif: # Whether to skip balanced if-else pairs. # Default: true @@ -573,6 +577,10 @@ linters-settings: # Size in bytes that makes the warning trigger. # Default: 80 sizeThreshold: 70 + ifElseChain: + # Min number of if-else blocks that makes the warning trigger. + # Default: 2 + minThreshold: 4 nestingReduce: # Min number of statements inside a branch to trigger a warning. # Default: 5 @@ -602,7 +610,7 @@ linters-settings: # Then: # ruleguard prints the specific Where() condition that was rejected. # - # The flag is passed to the ruleguard 'debug-group' argument. + # The option is passed to the ruleguard 'debug-group' argument. # Default: "" debug: 'emptyDecl' # Deprecated, use 'failOn' param. diff --git a/go.mod b/go.mod index 2d93575d5a6b..291258824606 100644 --- a/go.mod +++ b/go.mod @@ -37,7 +37,7 @@ require ( github.com/firefart/nonamedreturns v1.0.4 github.com/fzipp/gocyclo v0.6.0 github.com/ghostiam/protogetter v0.3.3 - github.com/go-critic/go-critic v0.10.0 + github.com/go-critic/go-critic v0.11.0 github.com/go-xmlfmt/xmlfmt v1.1.2 github.com/gofrs/flock v0.8.1 github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 diff --git a/go.sum b/go.sum index 6dcc6805935c..7d7b4121ded9 100644 --- a/go.sum +++ b/go.sum @@ -154,8 +154,8 @@ github.com/fzipp/gocyclo v0.6.0 h1:lsblElZG7d3ALtGMx9fmxeTKZaLLpU8mET09yN4BBLo= github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= github.com/ghostiam/protogetter v0.3.3 h1:EvOuzB/SEifg/c4aMnwcj033Qc1lHO7Yz4QnBDbmbik= github.com/ghostiam/protogetter v0.3.3/go.mod h1:A0JgIhs0fgVnotGinjQiKaFVG3waItLJNwPmcMzDnvk= -github.com/go-critic/go-critic v0.10.0 h1:tOkke48KSKC4tSS5Dc22ICdChMy0maRj1uDgdV5vXfc= -github.com/go-critic/go-critic v0.10.0/go.mod h1:gW4noMWDewS/WQdqiuJdA0pXbRxito860jj1ucPzy7g= +github.com/go-critic/go-critic v0.11.0 h1:mARtIFX7jPtJ3SzxO9Isa5T2jd2dZxFmQHK3yNf0wrE= +github.com/go-critic/go-critic v0.11.0/go.mod h1:Cz6lr1PlkIu/0Y0U9KqJgcIJJECAF8mEwmzVjKnhbfI= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= diff --git a/pkg/golinters/mirror.go b/pkg/golinters/mirror.go index 4adc001a19e3..d6e2bb06ac84 100644 --- a/pkg/golinters/mirror.go +++ b/pkg/golinters/mirror.go @@ -39,7 +39,7 @@ func NewMirror() *goanalysis.Linter { Pos: i.Start, } - if len(i.InlineFix) > 0 { + if i.InlineFix != "" { issue.Replacement = &result.Replacement{ Inline: &result.InlineFix{ StartCol: i.Start.Column - 1, diff --git a/pkg/golinters/nolintlint/nolintlint.go b/pkg/golinters/nolintlint/nolintlint.go index d40a109bc8ac..639a5b822c1d 100644 --- a/pkg/golinters/nolintlint/nolintlint.go +++ b/pkg/golinters/nolintlint/nolintlint.go @@ -171,7 +171,7 @@ func (l Linter) Run(fset *token.FileSet, nodes ...ast.Node) ([]Issue, error) { } directiveWithOptionalLeadingSpace := "//" - if len(leadingSpace) > 0 { + if leadingSpace != "" { directiveWithOptionalLeadingSpace += " " } @@ -188,7 +188,7 @@ func (l Linter) Run(fset *token.FileSet, nodes ...ast.Node) ([]Issue, error) { } // check for, report and eliminate leading spaces, so we can check for other issues - if len(leadingSpace) > 0 { + if leadingSpace != "" { removeWhitespace := &result.Replacement{ Inline: &result.InlineFix{ StartCol: pos.Column + 1, @@ -217,7 +217,7 @@ func (l Linter) Run(fset *token.FileSet, nodes ...ast.Node) ([]Issue, error) { lintersText, explanation := fullMatches[1], fullMatches[2] var linters []string - if len(lintersText) > 0 && !strings.HasPrefix(lintersText, "all") { + if lintersText != "" && !strings.HasPrefix(lintersText, "all") { lls := strings.Split(lintersText, ",") linters = make([]string, 0, len(lls)) rangeStart := (pos.Column - 1) + len("//") + len(leadingSpace) + len("nolint:")