Lower the stored result to count occurence

Signed-off-by: Hadi <[email protected]>
This commit is contained in:
Hadi
2025-08-23 14:52:53 +02:00
parent beec1a873c
commit b0c7ce633e
2 changed files with 16 additions and 12 deletions
+5 -4
View File
@@ -2,6 +2,7 @@ package recon
import (
"fmt"
"strings"
github_recon_settings "github.com/anotherhadi/github-recon/settings"
"github.com/anotherhadi/github-recon/utils"
@@ -49,7 +50,7 @@ func Commits(s github_recon_settings.Settings) (response CommitsResult) {
if utils.SkipResult(name, email) {
continue
}
if _, seen := results[name+" - "+email+" - "+login]; !seen {
if _, seen := results[strings.ToLower(name)+" - "+strings.ToLower(email)+" - "+strings.ToLower(login)]; !seen {
author := CommitResult{
Name: name,
Email: email,
@@ -58,11 +59,11 @@ func Commits(s github_recon_settings.Settings) (response CommitsResult) {
FirstFoundIn: item.GetRepository().Owner.GetLogin() + "/" + item.GetRepository().
GetName(),
}
results[name+" - "+email+" - "+login] = author
results[strings.ToLower(name)+" - "+strings.ToLower(email)+" - "+strings.ToLower(login)] = author
} else {
result := results[name+" - "+email+" - "+login]
result := results[strings.ToLower(name)+" - "+strings.ToLower(email)+" - "+strings.ToLower(login)]
result.Occurrences++
results[name+" - "+email+" - "+login] = result
results[strings.ToLower(name)+" - "+strings.ToLower(email)+" - "+strings.ToLower(login)] = result
}
}
}
+11 -8
View File
@@ -2,6 +2,7 @@ package recon
import (
"fmt"
"strings"
github_recon_settings "github.com/anotherhadi/github-recon/settings"
"github.com/anotherhadi/github-recon/utils"
@@ -54,25 +55,27 @@ func Commits(s github_recon_settings.Settings) (response CommitsResult) {
}
for i := range names {
if utils.SkipResult(names[i], emails[i]) {
name := names[i]
email := emails[i]
if utils.SkipResult(name, email) {
continue
}
if names[i] == "" || emails[i] == "" {
if name == "" || email == "" {
continue
}
if _, seen := results[names[i]+" - "+emails[i]]; !seen {
if _, seen := results[strings.ToLower(name)+" - "+strings.ToLower(email)]; !seen {
author := CommitResult{
Name: names[i],
Email: emails[i],
Name: name,
Email: email,
Occurrences: 1,
FirstFoundIn: item.GetRepository().Owner.GetLogin() + "/" + item.GetRepository().
GetName(),
}
results[names[i]+" - "+emails[i]] = author
results[strings.ToLower(name)+" - "+strings.ToLower(email)] = author
} else if i == 0 {
result := results[names[i]+" - "+emails[i]]
result := results[strings.ToLower(name)+" - "+strings.ToLower(email)]
result.Occurrences++
results[names[i]+" - "+emails[i]] = result
results[strings.ToLower(name)+" - "+strings.ToLower(email)] = result
}
}
}