mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-28 20:24:22 +01:00
refactoring after actually learning some go patterns
This commit is contained in:
1 parent
c8880ed911
commit
faca0e14d9
6 files changed
+549
-350
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user