Add some tests for IgnoreFiles

And log error on invalid regexp.

See #1189
This commit is contained in:
bep 2015-06-03 18:54:30 +02:00
parent beaa1b3aad
commit beeae6ab69
3 changed files with 33 additions and 18 deletions

View file

@ -151,8 +151,11 @@ func isNonProcessablePath(filePath string) bool {
ignoreFiles := viper.GetStringSlice("IgnoreFiles")
if len(ignoreFiles) > 0 {
for _, ignorePattern := range ignoreFiles {
match, _ := regexp.MatchString(ignorePattern, filePath)
if match {
match, err := regexp.MatchString(ignorePattern, filePath)
if err != nil {
helpers.DistinctErrorLog.Printf("Invalid regexp '%s' in ignoreFiles: %s", ignorePattern, err)
return false
} else if match {
return true
}
}