From dc2a2fc206f0d8248b7a6bc732859c0b81de80d3 Mon Sep 17 00:00:00 2001 From: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com> Date: Mon, 9 May 2022 09:15:19 -0500 Subject: [PATCH] :warning: Removing the confidence field from `CheckResult` struct - Removing the confidence field from `CheckResult` struct - https://github.com/ossf/scorecard/issues/1393 Signed-off-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com> --- checker/check_result.go | 19 +++++++------------ cron/format/json.go | 3 +-- pkg/json.go | 3 +-- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/checker/check_result.go b/checker/check_result.go index e73a9aea0cd4..38ad83817696 100644 --- a/checker/check_result.go +++ b/checker/check_result.go @@ -79,10 +79,9 @@ const ( // nolint:govet type CheckResult struct { // TODO(#1393): Remove old structure after deprecation. - Name string - Details []string - Confidence int - Pass bool + Name string + Details []string + Pass bool // UPGRADEv2: New structure. Omitting unchanged Name field // for simplicity. @@ -173,8 +172,7 @@ func CreateResultWithScore(name, reason string, score int) CheckResult { return CheckResult{ Name: name, // Old structure. - Confidence: MaxResultScore, - Pass: pass, + Pass: pass, // New structure. Version: 2, Error: nil, @@ -197,8 +195,7 @@ func CreateProportionalScoreResult(name, reason string, b, t int) CheckResult { return CheckResult{ Name: name, // Old structure. - Confidence: MaxResultConfidence, - Pass: pass, + Pass: pass, // New structure. Version: 2, Error: nil, @@ -228,8 +225,7 @@ func CreateInconclusiveResult(name, reason string) CheckResult { return CheckResult{ Name: name, // Old structure. - Confidence: 0, - Pass: false, + Pass: false, // New structure. Version: 2, Score: InconclusiveResultScore, @@ -242,8 +238,7 @@ func CreateRuntimeErrorResult(name string, e error) CheckResult { return CheckResult{ Name: name, // Old structure. - Confidence: 0, - Pass: false, + Pass: false, // New structure. Version: 2, Error: e, diff --git a/cron/format/json.go b/cron/format/json.go index b994a192fa46..fb42cc16bc69 100644 --- a/cron/format/json.go +++ b/cron/format/json.go @@ -96,8 +96,7 @@ func AsJSON(r *pkg.ScorecardResult, showDetails bool, logLevel log.Level, writer //nolint for _, checkResult := range r.Checks { tmpResult := jsonCheckResult{ - Name: checkResult.Name, - Confidence: checkResult.Confidence, + Name: checkResult.Name, } if showDetails { for i := range checkResult.Details2 { diff --git a/pkg/json.go b/pkg/json.go index 73042f219b37..57004b16667b 100644 --- a/pkg/json.go +++ b/pkg/json.go @@ -95,8 +95,7 @@ func (r *ScorecardResult) AsJSON(showDetails bool, logLevel log.Level, writer io //nolint for _, checkResult := range r.Checks { tmpResult := jsonCheckResult{ - Name: checkResult.Name, - Confidence: checkResult.Confidence, + Name: checkResult.Name, } if showDetails { for i := range checkResult.Details2 {