From 68573209d6d7df7e44e67cd6ffb68abfff0e1b68 Mon Sep 17 00:00:00 2001 From: AdamKorcz <44787359+AdamKorcz@users.noreply.github.com> Date: Tue, 28 Nov 2023 17:30:06 +0000 Subject: [PATCH] :seedling: make maintained values keys constants (#3700) Signed-off-by: Adam Korczynski Co-authored-by: Raghav Kaul <8695110+raghavkaul@users.noreply.github.com> --- checks/evaluation/maintained.go | 4 ++-- probes/hasRecentCommits/impl.go | 8 +++++--- probes/issueActivityByProjectMember/impl.go | 5 +++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/checks/evaluation/maintained.go b/checks/evaluation/maintained.go index bf4daeee897..3be51d577cb 100644 --- a/checks/evaluation/maintained.go +++ b/checks/evaluation/maintained.go @@ -67,9 +67,9 @@ func Maintained(name string, if f.Outcome == finding.OutcomePositive { switch f.Probe { case issueActivityByProjectMember.Probe: - numberOfIssuesUpdatedWithinThreshold = f.Values["numberOfIssuesUpdatedWithinThreshold"] + numberOfIssuesUpdatedWithinThreshold = f.Values[issueActivityByProjectMember.NoOfIssuesValue] case hasRecentCommits.Probe: - commitsWithinThreshold = f.Values["commitsWithinThreshold"] + commitsWithinThreshold = f.Values[hasRecentCommits.CommitsValue] } } } diff --git a/probes/hasRecentCommits/impl.go b/probes/hasRecentCommits/impl.go index fbd3abbd28e..8b4fb866003 100644 --- a/probes/hasRecentCommits/impl.go +++ b/probes/hasRecentCommits/impl.go @@ -29,7 +29,9 @@ import ( var fs embed.FS const ( - lookBackDays = 90 + lookBackDays = 90 + CommitsValue = "commitsWithinThreshold" + LookBackValue = "lookBackDays" ) const Probe = "hasRecentCommits" @@ -60,8 +62,8 @@ func Run(raw *checker.RawResults) ([]finding.Finding, string, error) { return nil, Probe, fmt.Errorf("create finding: %w", err) } f = f.WithValues(map[string]int{ - "commitsWithinThreshold": commitsWithinThreshold, - "lookBackDays": 90, + CommitsValue: commitsWithinThreshold, + LookBackValue: lookBackDays, }) findings = append(findings, *f) } else { diff --git a/probes/issueActivityByProjectMember/impl.go b/probes/issueActivityByProjectMember/impl.go index 493c075ac74..04d000cd4f2 100644 --- a/probes/issueActivityByProjectMember/impl.go +++ b/probes/issueActivityByProjectMember/impl.go @@ -30,7 +30,8 @@ import ( var fs embed.FS const ( - lookBackDays = 90 + lookBackDays = 90 + NoOfIssuesValue = "numberOfIssuesUpdatedWithinThreshold" ) const Probe = "issueActivityByProjectMember" @@ -60,7 +61,7 @@ func Run(raw *checker.RawResults) ([]finding.Finding, string, error) { return nil, Probe, fmt.Errorf("create finding: %w", err) } f = f.WithValues(map[string]int{ - "numberOfIssuesUpdatedWithinThreshold": numberOfIssuesUpdatedWithinThreshold, + NoOfIssuesValue: numberOfIssuesUpdatedWithinThreshold, }) findings = append(findings, *f) } else {