mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-30 05:04:22 +01:00
Make AddFindings public (#1767)
- Rename d.addFindings -> d.AddFindings - Add d.Findings() To allow other tools using d.Detect() to leverage the code in AddFindings
This commit is contained in:
1 parent
59fdd904af
commit
f6a7439306
4 files changed
+11
-6
No files matched your search
+8
-3
@@ -568,8 +568,8 @@ func allTrue(bools []bool) bool {
|
||||
return allMatch
|
||||
}
|
||||
|
||||
// addFinding synchronously adds a finding to the findings slice
|
||||
func (d *Detector) addFinding(finding report.Finding) {
|
||||
// AddFinding synchronously adds a finding to the findings slice
|
||||
func (d *Detector) AddFinding(finding report.Finding) {
|
||||
globalFingerprint := fmt.Sprintf("%s:%s:%d", finding.File, finding.RuleID, finding.StartLine)
|
||||
if finding.Commit != "" {
|
||||
finding.Fingerprint = fmt.Sprintf("%s:%s:%s:%d", finding.Commit, finding.File, finding.RuleID, finding.StartLine)
|
||||
@@ -609,7 +609,12 @@ func (d *Detector) addFinding(finding report.Finding) {
|
||||
d.findingMutex.Unlock()
|
||||
}
|
||||
|
||||
// addCommit synchronously adds a commit to the commit slice
|
||||
// Findings returns the findings added to the detector
|
||||
func (d *Detector) Findings() []report.Finding {
|
||||
return d.findings
|
||||
}
|
||||
|
||||
// AddCommit synchronously adds a commit to the commit slice
|
||||
func (d *Detector) addCommit(commit string) {
|
||||
d.commitMap[commit] = true
|
||||
}
|
||||
Reference in new issue
Block a user