yay no deps, using shannon entropy straight up, stop words

This commit is contained in:
zricethezav committed 2018-02-19 17:41:15 -06:00
1 parent d465c3d2f1
commit 8f352bd840
25 files changed
+27 -1958

No files matched your search

+4 -5
View File
@@ -16,8 +16,8 @@ import (
// LeakElem contains the line and commit of a leak
type LeakElem struct {
Line string `json:"line"`
Commit string `json:"commit"`
Content string `json:"content"`
Commit string `json:"commit"`
}
// start clones and determines if there are any leaks
@@ -96,8 +96,7 @@ func getLeaks(repoName string, opts *Options) []LeakElem {
go func(commitWG *sync.WaitGroup, gitLeakReceiverWG *sync.WaitGroup) {
for gitLeak := range gitLeaks {
//defer gitLeakReceiverWG.Done()
fmt.Println(gitLeak)
fmt.Printf("commit: %s\ncontent: %s\n\n", gitLeak.Commit, gitLeak.Content)
report = append(report, gitLeak)
gitLeakReceiverWG.Done()
}
@@ -146,7 +145,7 @@ func getLeaks(repoName string, opts *Options) []LeakElem {
for _, line := range lines {
leakPrs = checkShannonEntropy(line, opts.EntropyCutoff)
if leakPrs {
if opts.Strict && checkStopWords(line) {
if opts.Strict && containsStopWords(line) {
continue
}
gitLeakReceiverWG.Add(1)