From a43c58854fa9d1b3ddd06603281513160bd8ce96 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adolfo=20Garc=C3=ADa=20Veytia=20=28Puerco=29?=
 <adolfo.garcia@uservers.net>
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) <adolfo.garcia@uservers.net>
---
 pkg/scorecard/scorecard_result.go | 10 ++++++----
 pkg/scorecard/statement.go        |  9 +++++++--
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/pkg/scorecard/scorecard_result.go b/pkg/scorecard/scorecard_result.go
index 367638d219bd..595a6bd3fda3 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 d345cada6989..9e920de31028 100644
--- a/pkg/scorecard/statement.go
+++ b/pkg/scorecard/statement.go
@@ -40,8 +40,13 @@ type Predicate struct {
 	JSONScorecardResultV2
 }
 
+// AsStatementResultOption wraps AsJSON2ResultOption preparing it for
+type AsStatementResultOption struct {
+	AsJSON2ResultOption
+}
+
 // 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,
@@ -51,7 +56,7 @@ func (r *Result) AsStatement(writer io.Writer, checkDocs docs.Doc, opt *AsJSON2R
 		},
 	}
 
-	json2, err := r.resultsToJSON2(checkDocs, opt)
+	json2, err := r.resultsToJSON2(checkDocs, &opt.AsJSON2ResultOption)
 	if err != nil {
 		return sce.WithMessage(sce.ErrScorecardInternal, err.Error())
 	}