Skip to content

Commit 465834a

Browse files
committed
chore: update doc and code
1 parent c736fce commit 465834a

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

.golangci.reference.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,10 @@ linters-settings:
565565
# Whether to restrict checker to params only.
566566
# Default: true
567567
paramsOnly: false
568+
commentedOutCode:
569+
# Min length of the comment that triggers a warning.
570+
# Default: 15
571+
minLength: 50
568572
elseif:
569573
# Whether to skip balanced if-else pairs.
570574
# Default: true
@@ -573,6 +577,10 @@ linters-settings:
573577
# Size in bytes that makes the warning trigger.
574578
# Default: 80
575579
sizeThreshold: 70
580+
ifElseChain:
581+
# Min number of if-else blocks that makes the warning trigger.
582+
# Default: 2
583+
minThreshold: 4
576584
nestingReduce:
577585
# Min number of statements inside a branch to trigger a warning.
578586
# Default: 5
@@ -602,7 +610,7 @@ linters-settings:
602610
# Then:
603611
# ruleguard prints the specific Where() condition that was rejected.
604612
#
605-
# The flag is passed to the ruleguard 'debug-group' argument.
613+
# The option is passed to the ruleguard 'debug-group' argument.
606614
# Default: ""
607615
debug: 'emptyDecl'
608616
# Deprecated, use 'failOn' param.

pkg/golinters/mirror.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func NewMirror() *goanalysis.Linter {
3939
Pos: i.Start,
4040
}
4141

42-
if len(i.InlineFix) > 0 {
42+
if i.InlineFix != "" {
4343
issue.Replacement = &result.Replacement{
4444
Inline: &result.InlineFix{
4545
StartCol: i.Start.Column - 1,

pkg/golinters/nolintlint/nolintlint.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ func (l Linter) Run(fset *token.FileSet, nodes ...ast.Node) ([]Issue, error) {
171171
}
172172

173173
directiveWithOptionalLeadingSpace := "//"
174-
if len(leadingSpace) > 0 {
174+
if leadingSpace != "" {
175175
directiveWithOptionalLeadingSpace += " "
176176
}
177177

@@ -188,7 +188,7 @@ func (l Linter) Run(fset *token.FileSet, nodes ...ast.Node) ([]Issue, error) {
188188
}
189189

190190
// check for, report and eliminate leading spaces, so we can check for other issues
191-
if len(leadingSpace) > 0 {
191+
if leadingSpace != "" {
192192
removeWhitespace := &result.Replacement{
193193
Inline: &result.InlineFix{
194194
StartCol: pos.Column + 1,
@@ -217,7 +217,7 @@ func (l Linter) Run(fset *token.FileSet, nodes ...ast.Node) ([]Issue, error) {
217217
lintersText, explanation := fullMatches[1], fullMatches[2]
218218

219219
var linters []string
220-
if len(lintersText) > 0 && !strings.HasPrefix(lintersText, "all") {
220+
if lintersText != "" && !strings.HasPrefix(lintersText, "all") {
221221
lls := strings.Split(lintersText, ",")
222222
linters = make([]string, 0, len(lls))
223223
rangeStart := (pos.Column - 1) + len("//") + len(leadingSpace) + len("nolint:")

0 commit comments

Comments
 (0)