change isGenerated heuristic to match more generated files

As observed in #30, there's tools out there that don't comply 100% with
the referenced golang convention.

With this change, golangci-lint will skip some more of those generated
files.

Signed-off-by: Stephan Renatus <srenatus@chef.io>
This commit is contained in:
Stephan Renatus 2018-05-31 09:11:51 +02:00
parent 21ff49ce6d
commit 468d2334ea
4 changed files with 43 additions and 15 deletions

View file

@ -37,13 +37,22 @@ func TestNolint(t *testing.T) {
processAssertSame(t, p, newNolintFileIssue(1, "golint")) // no directive
}
func TestNoIssuesInAutogeneratedFile(t *testing.T) {
i := result.Issue{
Pos: token.Position{
Filename: filepath.Join("testdata", "nolint_autogenerated.go"),
Line: 4,
},
func TestNoIssuesInAutogeneratedFiles(t *testing.T) {
files := []string{
"nolint_autogenerated.go",
"nolint_autogenerated_alt_hdr.go",
"nolint_autogenerated_alt_hdr2.go",
}
for _, file := range files {
t.Run(file, func(t *testing.T) {
i := result.Issue{
Pos: token.Position{
Filename: filepath.Join("testdata", file),
Line: 4,
},
}
p := NewNolint(token.NewFileSet())
processAssertEmpty(t, p, i)
})
}
p := NewNolint(token.NewFileSet())
processAssertEmpty(t, p, i)
}