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 ( import (
"fmt" "fmt"
"strings"
github_recon_settings "github.com/anotherhadi/github-recon/settings" github_recon_settings "github.com/anotherhadi/github-recon/settings"
"github.com/anotherhadi/github-recon/utils" "github.com/anotherhadi/github-recon/utils"
@@ -49,7 +50,7 @@ func Commits(s github_recon_settings.Settings) (response CommitsResult) {
if utils.SkipResult(name, email) { if utils.SkipResult(name, email) {
continue continue
} }
if _, seen := results[name+" - "+email+" - "+login]; !seen { if _, seen := results[strings.ToLower(name)+" - "+strings.ToLower(email)+" - "+strings.ToLower(login)]; !seen {
author := CommitResult{ author := CommitResult{
Name: name, Name: name,
Email: email, Email: email,
@@ -58,11 +59,11 @@ func Commits(s github_recon_settings.Settings) (response CommitsResult) {
FirstFoundIn: item.GetRepository().Owner.GetLogin() + "/" + item.GetRepository(). FirstFoundIn: item.GetRepository().Owner.GetLogin() + "/" + item.GetRepository().
GetName(), GetName(),
} }
results[name+" - "+email+" - "+login] = author results[strings.ToLower(name)+" - "+strings.ToLower(email)+" - "+strings.ToLower(login)] = author
} else { } else {
result := results[name+" - "+email+" - "+login] result := results[strings.ToLower(name)+" - "+strings.ToLower(email)+" - "+strings.ToLower(login)]
result.Occurrences++ 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 ( import (
"fmt" "fmt"
"strings"
github_recon_settings "github.com/anotherhadi/github-recon/settings" github_recon_settings "github.com/anotherhadi/github-recon/settings"
"github.com/anotherhadi/github-recon/utils" "github.com/anotherhadi/github-recon/utils"
@@ -54,25 +55,27 @@ func Commits(s github_recon_settings.Settings) (response CommitsResult) {
} }
for i := range names { for i := range names {
if utils.SkipResult(names[i], emails[i]) { name := names[i]
email := emails[i]
if utils.SkipResult(name, email) {
continue continue
} }
if names[i] == "" || emails[i] == "" { if name == "" || email == "" {
continue continue
} }
if _, seen := results[names[i]+" - "+emails[i]]; !seen { if _, seen := results[strings.ToLower(name)+" - "+strings.ToLower(email)]; !seen {
author := CommitResult{ author := CommitResult{
Name: names[i], Name: name,
Email: emails[i], Email: email,
Occurrences: 1, Occurrences: 1,
FirstFoundIn: item.GetRepository().Owner.GetLogin() + "/" + item.GetRepository(). FirstFoundIn: item.GetRepository().Owner.GetLogin() + "/" + item.GetRepository().
GetName(), GetName(),
} }
results[names[i]+" - "+emails[i]] = author results[strings.ToLower(name)+" - "+strings.ToLower(email)] = author
} else if i == 0 { } else if i == 0 {
result := results[names[i]+" - "+emails[i]] result := results[strings.ToLower(name)+" - "+strings.ToLower(email)]
result.Occurrences++ result.Occurrences++
results[names[i]+" - "+emails[i]] = result results[strings.ToLower(name)+" - "+strings.ToLower(email)] = result
} }
} }
} }