From 05f6ed4bfa3c0986543053527bd5f3e496c95591 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20Garc=C3=ADa=20Veytia=20=28Puerco=29?= Date: Fri, 17 Jan 2025 13:09:29 -0600 Subject: [PATCH] AsStatementResultOption MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds an options set for the intoto statement output. It just wraps the json2 options for now. Signed-off-by: Adolfo GarcĂ­a Veytia (Puerco) --- pkg/scorecard/scorecard_result.go | 10 ++++++---- pkg/scorecard/statement.go | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pkg/scorecard/scorecard_result.go b/pkg/scorecard/scorecard_result.go index 367638d219b..595a6bd3fda 100644 --- a/pkg/scorecard/scorecard_result.go +++ b/pkg/scorecard/scorecard_result.go @@ -157,10 +157,12 @@ func FormatResults( } err = results.AsJSON2(output, doc, o) case options.FormatStatement: - o := &AsJSON2ResultOption{ - Details: opts.ShowDetails, - Annotations: opts.ShowAnnotations, - LogLevel: log.ParseLevel(opts.LogLevel), + o := &AsStatementResultOption{ + AsJSON2ResultOption: AsJSON2ResultOption{ + Details: opts.ShowDetails, + Annotations: opts.ShowAnnotations, + LogLevel: log.ParseLevel(opts.LogLevel), + }, } err = results.AsStatement(output, doc, o) case options.FormatProbe: diff --git a/pkg/scorecard/statement.go b/pkg/scorecard/statement.go index 4eb3470e4c7..809fc7ae8f7 100644 --- a/pkg/scorecard/statement.go +++ b/pkg/scorecard/statement.go @@ -47,7 +47,7 @@ type AsStatementResultOption struct { } // AsStatement converts the results as an in-toto statement. -func (r *Result) AsStatement(writer io.Writer, checkDocs docs.Doc, opt *AsJSON2ResultOption) error { +func (r *Result) AsStatement(writer io.Writer, checkDocs docs.Doc, opt *AsStatementResultOption) error { // Build the attestation subject from the result Repo. subject := intoto.ResourceDescriptor{ Name: r.Repo.Name,