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/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:")