Skip to content

Commit d1c756e

Browse files
committed
Implement ignore config
1 parent d881b7d commit d1c756e

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ The format is as follows:
108108
# If omitted, the default command is used.
109109
# type: list of strings
110110
command = []
111+
# Specify file path patterns to exclude from processing using the .gitignore format.
112+
# https://git-scm.com/docs/gitignore/en#_pattern_format
113+
# type: list of strings
114+
ignore = []
111115

112116
[history]
113117
# Limits the number of test executions to keep in history.

cmd/gotip/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func run(args []string) (int, error) {
7979
return code, nil
8080
}
8181

82-
tests, err := parse.ProcessFilesRecursively(".", opt.SkipSubtests)
82+
tests, err := parse.ProcessFilesRecursively(".", conf.Ignore, opt.SkipSubtests)
8383
if err != nil {
8484
return 1, err
8585
}

internal/parse/parse.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ var defaultIgnoreDirs = []string{
1616
"testdata",
1717
}
1818

19-
func ProcessFilesRecursively(rootDir string, skipSubtests bool) (map[string][]*tip.TestFunction, error) {
19+
func ProcessFilesRecursively(rootDir string, ignore []string, skipSubtests bool) (map[string][]*tip.TestFunction, error) {
2020
fileListQueue := make(chan *gocodewalker.File, 100)
2121

2222
fileWalker := gocodewalker.NewFileWalker(rootDir, fileListQueue)
2323
fileWalker.AllowListExtensions = append(fileWalker.AllowListExtensions, "go")
2424
fileWalker.ExcludeDirectory = append(fileWalker.ExcludeDirectory, defaultIgnoreDirs...)
25+
fileWalker.CustomIgnorePatterns = append(fileWalker.CustomIgnorePatterns, ignore...)
2526

2627
go fileWalker.Start()
2728

internal/tip/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const (
1616

1717
type Config struct {
1818
Command []string `toml:"command"`
19+
Ignore []string `toml:"ignore"`
1920
History HistoryConfig `toml:"history"`
2021
}
2122

@@ -27,6 +28,7 @@ type HistoryConfig struct {
2728
func defaultConfig() *Config {
2829
return &Config{
2930
Command: []string{},
31+
Ignore: []string{},
3032
History: HistoryConfig{
3133
Limit: defaultHistoryLimit,
3234
DateFormat: defaultDateFormat,

0 commit comments

Comments
 (0)