Skip to content

Commit

Permalink
Merge pull request #37 from wuwen5/wuwen5-patch-1
Browse files Browse the repository at this point in the history
fixed #36 完善java测试文件过滤器,增加对测试包路径的判断
  • Loading branch information
phodal authored May 22, 2023
2 parents e25b836 + 6975ae3 commit de27fe2
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions pkg/adapter/cocafile/file_filter.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
package cocafile

import "strings"
import (
"path/filepath"
"strings"
)

var isJavaTestFile = func(path string) bool {
return strings.HasSuffix(path, "Test.java") || strings.HasSuffix(path, "Tests.java")
}

var isJavaTestPackage = func(path string) bool {
path = filepath.ToSlash(path)
return strings.Contains(path, "src/test/java/")
}

var JavaTestFileFilter = func(path string) bool {
return strings.Contains(path, "Test.java") || strings.Contains(path, "Tests.java")
return isJavaTestFile(path) || isJavaTestPackage(path)
}

var JavaCodeFileFilter = func(path string) bool {
Expand Down

0 comments on commit de27fe2

Please sign in to comment.