Skip to content

Commit

Permalink
Merge pull request #11 from stacklok/amend-provenance-formatting
Browse files Browse the repository at this point in the history
fix: correct formatting for provenance
  • Loading branch information
yrobla authored Apr 25, 2024
2 parents 93044e4 + 68218b9 commit bf48970
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions pkg/trustyapi/trustyapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ func ProcessDependency(dep string, ecosystem string, scoreThreshold float64) (st
} else {
// need to write regular provenance info
reportBuilder.WriteString("### :key: Proof of origin (Provenance):\n")
reportBuilder.WriteString(fmt.Sprintf("# versions: %.0f\n", result.Provenance.Description.Hp.Versions))
reportBuilder.WriteString(fmt.Sprintf("# tags: %.0f\n", result.Provenance.Description.Hp.Tags))
reportBuilder.WriteString(fmt.Sprintf("# matched: %.0f\n", result.Provenance.Description.Hp.Common))
reportBuilder.WriteString(fmt.Sprintf("· Number of versions: %.0f\n", result.Provenance.Description.Hp.Versions))
reportBuilder.WriteString(fmt.Sprintf("· Number of Git Tags/Releases: %.0f\n", result.Provenance.Description.Hp.Tags))
reportBuilder.WriteString(fmt.Sprintf("· Number of versions matched to Git Tags/Releases: %.0f\n", result.Provenance.Description.Hp.Common))
}
reportBuilder.WriteString("[Learn more about source of origin provenance](https://docs.stacklok.com/trusty/understand/provenance)\n")

Expand Down
6 changes: 3 additions & 3 deletions pkg/trustyapi/trustyapi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ func TestProcessHistoricalProvenance(t *testing.T) {
scoreThreshold := 10.0

report, _ := ProcessDependency("openpgp", ecosystem, scoreThreshold)
if !strings.Contains(report, "# versions") {
if !strings.Contains(report, "Number of versions") {
t.Errorf("Versions for historical provenance not populated")
}
if !strings.Contains(report, "# tags") {
if !strings.Contains(report, "Number of Git Tags/Releases") {
t.Errorf("Tags for historical provenance not populated")
}
if !strings.Contains(report, "# matched") {
if !strings.Contains(report, "Number of versions matched to Git Tags/Releases") {
t.Errorf("Matched for historical provenance not populated")
}

Expand Down

0 comments on commit bf48970

Please sign in to comment.