mirror of
https://github.com/scratchfoundation/golangci-lint.git
synced 2025-08-28 22:28:43 -04:00
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:
parent
21ff49ce6d
commit
468d2334ea
4 changed files with 43 additions and 15 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue