Skip to content

Commit

Permalink
Allow a single issue to fulfill multiple ignore ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
ashanbrown committed Dec 23, 2020
1 parent 1b24cfe commit e593eef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions pkg/golinters/scopelint.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ func (f *Node) Visit(node ast.Node) ast.Visitor {
// The variadic arguments may start with link and category types,
// and must end with a format string and any arguments.
// It returns the new Problem.
//nolint:interfacer
func (f *Node) errorf(n ast.Node, format string, args ...interface{}) {
pos := f.fset.Position(n.Pos())
f.errorAtf(pos, format, args...)
Expand Down
6 changes: 4 additions & 2 deletions pkg/result/processors/nolint.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,16 @@ func (p *Nolint) shouldPassIssue(i *result.Issue) (bool, error) {
return false, err
}

matchesSomething := false
for _, ir := range fd.ignoredRanges {
if ir.doesMatch(i) {
// for nolintlint, we need to consider every range
ir.matchedIssueFromLinter[i.FromLinter] = true
return false, nil
matchesSomething = true
}
}

return true, nil
return !matchesSomething, nil
}

type rangeExpander struct {
Expand Down

0 comments on commit e593eef

Please sign in to comment.