Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⚠️ Removing the confidence field from CheckResult struct #1896

Merged
merged 1 commit into from May 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 7 additions & 12 deletions checker/check_result.go
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions cron/format/json.go
Expand Up @@ -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 {
Expand Down
3 changes: 1 addition & 2 deletions pkg/json.go
Expand Up @@ -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 {
Expand Down