mirror of
https://github.com/scratchfoundation/golangci-lint.git
synced 2025-08-28 22:28:43 -04:00
Unknown linter breaks //nolint (#1497)
* Unknown linter breaks //nolint * Testing if nolint directive for unknown linter silences violation on the same line
This commit is contained in:
parent
b1755c16ea
commit
947dae101e
3 changed files with 29 additions and 6 deletions
|
@ -149,6 +149,28 @@ func TestNolintInvalidLinterName(t *testing.T) {
|
|||
p.Finish()
|
||||
}
|
||||
|
||||
func TestNolintInvalidLinterNameWithViolationOnTheSameLine(t *testing.T) {
|
||||
log := getMockLog()
|
||||
log.On("Warnf", "Found unknown linters in //nolint directives: %s", "foobar")
|
||||
issues := []result.Issue{
|
||||
{
|
||||
Pos: token.Position{
|
||||
Filename: filepath.Join("testdata", "nolint_apply_to_unknown.go"),
|
||||
Line: 4,
|
||||
},
|
||||
FromLinter: "gofmt",
|
||||
},
|
||||
}
|
||||
|
||||
p := newTestNolintProcessor(log)
|
||||
processedIssues, err := p.Process(issues)
|
||||
p.Finish()
|
||||
|
||||
assert.Len(t, processedIssues, 1)
|
||||
assert.Equal(t, issues, processedIssues)
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestNolintAliases(t *testing.T) {
|
||||
p := newTestNolintProcessor(getMockLog())
|
||||
for _, line := range []int{47, 49, 51} {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue