Adding global file regex to AuditUncommitted

This commit is contained in:
Peter Gallagher committed 2019-11-28 22:53:08 +00:00
1 parent 9b3342fbff
commit c04e137b28
1 file changed
+12
+12
View File
@@ -157,6 +157,18 @@ func (repo *Repo) AuditUncommitted() error {
if fileMatched(filename, repo.config.Whitelist.File) {
log.Debugf("whitelisted file found, skipping audit of file: %s", filename)
} else if fileMatched(filename, repo.config.FileRegex) {
repo.Manager.SendLeaks(manager.Leak{
Line: "N/A",
Offender: filename,
Commit: c.Hash.String(),
Repo: repo.Name,
Rule: "file regex matched" + repo.config.FileRegex.String(),
Author: c.Author.Name,
Email: c.Author.Email,
Date: c.Author.When,
File: filename,
})
} else {
dmp := diffmatchpatch.New()
diffs := dmp.DiffMain(prevFileContents, currFileContents, false)