data: replace substring package with regex package

This commit is contained in:
Máximo Cuadros
2020-04-15 17:27:48 +02:00
parent b34576bd71
commit 29bc0a181b
10 changed files with 401 additions and 395 deletions

View File

@ -1,17 +1,17 @@
package data
import "gopkg.in/toqueteos/substring.v1"
import "github.com/go-enry/go-enry/v2/regex"
// TestMatchers is hand made collection of regexp used by the function `enry.IsTest`
// to identify test files in different languages.
var TestMatchers = substring.Or(
substring.Regexp(`(^|/)tests/.*Test\.php$`),
substring.Regexp(`(^|/)test/.*Test(s?)\.java$`),
substring.Regexp(`(^|/)test(/|/.*/)Test.*\.java$`),
substring.Regexp(`(^|/)test/.*(Test(s?)|Spec(s?))\.scala$`),
substring.Regexp(`(^|/)test_.*\.py$`),
substring.Regexp(`(^|/).*_test\.go$`),
substring.Regexp(`(^|/).*_(test|spec)\.rb$`),
substring.Regexp(`(^|/).*Test(s?)\.cs$`),
substring.Regexp(`(^|/).*\.(test|spec)\.(ts|tsx|js)$`),
)
var TestMatchers = []regex.EnryRegexp{
regex.MustCompile(`(^|/)tests/.*Test\.php$`),
regex.MustCompile(`(^|/)test/.*Test(s?)\.java$`),
regex.MustCompile(`(^|/)test(/|/.*/)Test.*\.java$`),
regex.MustCompile(`(^|/)test/.*(Test(s?)|Spec(s?))\.scala$`),
regex.MustCompile(`(^|/)test_.*\.py$`),
regex.MustCompile(`(^|/).*_test\.go$`),
regex.MustCompile(`(^|/).*_(test|spec)\.rb$`),
regex.MustCompile(`(^|/).*Test(s?)\.cs$`),
regex.MustCompile(`(^|/).*\.(test|spec)\.(ts|tsx|js)$`),
}