feat(scanner): add a new option for excluding paths based on a regexp
* Exclude paths based on new exclude pattern option * Add test for excluded paths * Add exclude pattern option to docs * Set exclude regexp only if given argument is set * Update scanner/scanner.go --------- Co-authored-by: Senan Kelly <senan@senan.xyz>
This commit is contained in:
@@ -27,10 +27,13 @@ type MockFS struct {
|
||||
db *db.DB
|
||||
}
|
||||
|
||||
func New(t testing.TB) *MockFS { return new(t, []string{""}) }
|
||||
func NewWithDirs(t testing.TB, dirs []string) *MockFS { return new(t, dirs) }
|
||||
func New(t testing.TB) *MockFS { return new(t, []string{""}, "") }
|
||||
func NewWithDirs(t testing.TB, dirs []string) *MockFS { return new(t, dirs, "") }
|
||||
func NewWithExcludePattern(t testing.TB, excludePattern string) *MockFS {
|
||||
return new(t, []string{""}, excludePattern)
|
||||
}
|
||||
|
||||
func new(t testing.TB, dirs []string) *MockFS {
|
||||
func new(t testing.TB, dirs []string, excludePattern string) *MockFS {
|
||||
dbc, err := db.NewMock()
|
||||
if err != nil {
|
||||
t.Fatalf("create db: %v", err)
|
||||
@@ -59,7 +62,7 @@ func new(t testing.TB, dirs []string) *MockFS {
|
||||
}
|
||||
|
||||
tagReader := &tagReader{paths: map[string]*tagReaderResult{}}
|
||||
scanner := scanner.New(absDirs, dbc, ";", tagReader)
|
||||
scanner := scanner.New(absDirs, dbc, ";", tagReader, excludePattern)
|
||||
|
||||
return &MockFS{
|
||||
t: t,
|
||||
|
||||
Reference in New Issue
Block a user