Whitelist repo (#378)

* fixing commit latest bug

* bumping go-git and adding repo whitelist

* adding tests
This commit is contained in:
Zachary Rice authored and GitHub committed 2020-05-09 10:38:02 -04:00
1 parent 8bd4649b01
commit 473d0d55a7
12 files changed
+282 -65

No files matched your search

+12
View File
@@ -51,6 +51,7 @@ type Config struct {
Commits []string
Files []*regexp.Regexp
Paths []*regexp.Regexp
Repos []*regexp.Regexp
}
}
@@ -63,6 +64,7 @@ type TomlLoader struct {
Commits []string
Files []string
Paths []string
Repos []string
}
Rules []struct {
Description string
@@ -210,6 +212,16 @@ func (tomlLoader TomlLoader) Parse() (Config, error) {
}
cfg.Whitelist.Paths = append(cfg.Whitelist.Paths, re)
}
// global repo whitelists
for _, wlRepo := range tomlLoader.Whitelist.Repos {
re, err := regexp.Compile(wlRepo)
if err != nil {
return cfg, fmt.Errorf("problem loading config: %v", err)
}
cfg.Whitelist.Repos = append(cfg.Whitelist.Repos, re)
}
cfg.Whitelist.Commits = tomlLoader.Whitelist.Commits
cfg.Whitelist.Description = tomlLoader.Whitelist.Description