refactoring after actually learning some go patterns

This commit is contained in:
zricethezav committed 2018-02-27 21:56:46 -06:00
1 parent c8880ed911
commit faca0e14d9
6 files changed
+549 -350

No files matched your search

+5 -5
View File
@@ -9,11 +9,11 @@ import (
// TODO LOCAL REPO!!!!
// checks Regex and if enabled, entropy and stopwords
func doChecks(diff string, commit Commit, opts *Options, repo RepoDesc) []LeakElem {
func doChecks(diff string, commit Commit, opts *Options, repo *Repo) []Leak {
var (
match string
leaks []LeakElem
leak LeakElem
leaks []Leak
leak Leak
)
lines := strings.Split(diff, "\n")
@@ -34,7 +34,7 @@ func doChecks(diff string, commit Commit, opts *Options, repo RepoDesc) []LeakEl
continue
}
leak = LeakElem{
leak = Leak{
Line: line,
Commit: commit.Hash,
Offender: match,
@@ -109,7 +109,7 @@ func checkShannonEntropy(target string, opts *Options) bool {
func containsStopWords(target string) bool {
// Convert to lowercase to reduce the number of loops needed.
target = strings.ToLower(target)
for _, stopWord := range stopWords {
if strings.Contains(target, stopWord) {
return true