1
0
mirror of https://github.com/mgechev/revive.git synced 2025-01-22 03:38:47 +02:00

fix: dot-imports does not check test files (#884)

This commit is contained in:
Denis Voytyuk 2023-08-30 08:06:58 +02:00 committed by GitHub
parent 883c4cc199
commit ca0678cd08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,9 +39,8 @@ type lintImports struct {
} }
func (w lintImports) Visit(_ ast.Node) ast.Visitor { func (w lintImports) Visit(_ ast.Node) ast.Visitor {
for i, is := range w.fileAst.Imports { for _, is := range w.fileAst.Imports {
_ = i if is.Name != nil && is.Name.Name == "." {
if is.Name != nil && is.Name.Name == "." && !w.file.IsTest() {
w.onFailure(lint.Failure{ w.onFailure(lint.Failure{
Confidence: 1, Confidence: 1,
Failure: "should not use dot imports", Failure: "should not use dot imports",