Skip to content

Commit

Permalink
AsStatementResultOption
Browse files Browse the repository at this point in the history
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) <[email protected]>
  • Loading branch information
puerco committed Jan 17, 2025
1 parent 0d5d2c6 commit 05f6ed4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions pkg/scorecard/scorecard_result.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check warning on line 167 in pkg/scorecard/scorecard_result.go

View check run for this annotation

Codecov / codecov/patch

pkg/scorecard/scorecard_result.go#L159-L167

Added lines #L159 - L167 were not covered by tests
case options.FormatProbe:
Expand Down
2 changes: 1 addition & 1 deletion pkg/scorecard/statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 05f6ed4

Please sign in to comment.