@@ -9,10 +9,12 @@ import (
99 "github.com/zricethezav/gitleaks/v8/report"
1010)
1111
12- func IsNew (finding report.Finding , redact uint , baseline []report.Finding ) bool {
12+ //nolint:gocyclo // TODO: refactor this function to reduce cyclomatic complexity
13+ func IsNew (finding * report.Finding , redact uint , baseline []report.Finding ) bool {
1314 // Explicitly testing each property as it gives significantly better performance in comparison to cmp.Equal(). Drawback is that
1415 // the code requires maintenance if/when the Finding struct changes
15- for _ , b := range baseline {
16+ for i := range baseline {
17+ b := & baseline [i ]
1618 if finding .RuleID == b .RuleID &&
1719 finding .Description == b .Description &&
1820 finding .StartLine == b .StartLine &&
@@ -26,7 +28,7 @@ func IsNew(finding report.Finding, redact uint, baseline []report.Finding) bool
2628 finding .Email == b .Email &&
2729 finding .Date == b .Date &&
2830 finding .Message == b .Message &&
29- // Omit checking finding.Fingerprint - if the format of the fingerprint changes, the users will see unexpected behaviour
31+ // Omit checking finding.Fingerprint - if the format of the fingerprint changes, the users will see unexpected behavior
3032 finding .Entropy == b .Entropy {
3133 return false
3234 }
@@ -49,7 +51,7 @@ func LoadBaseline(baselinePath string) ([]report.Finding, error) {
4951 return previousFindings , nil
5052}
5153
52- func (d * Detector ) AddBaseline (baselinePath string , source string ) error {
54+ func (d * Detector ) AddBaseline (baselinePath , source string ) error {
5355 if baselinePath != "" {
5456 absoluteSource , err := filepath .Abs (source )
5557 if err != nil {
@@ -73,7 +75,6 @@ func (d *Detector) AddBaseline(baselinePath string, source string) error {
7375
7476 d .baseline = baseline
7577 baselinePath = relativeBaseline
76-
7778 }
7879
7980 d .baselinePath = baselinePath
0 commit comments