Replace checker.Release with clients.Release (#1946)

Co-authored-by: Azeem Shaikh <azeems@google.com>
This commit is contained in:
Azeem Shaikh 2022-05-23 19:05:02 -07:00 committed by GitHub
parent 33e3106320
commit 9a2a4f16bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 37 deletions

View File

@ -93,7 +93,7 @@ type BinaryArtifactData struct {
// SignedReleasesData contains the raw results
// for the Signed-Releases check.
type SignedReleasesData struct {
Releases []Release
Releases []clients.Release
}
// DependencyUpdateToolData contains the raw results
@ -271,20 +271,6 @@ type Vulnerability struct {
// TODO(vuln): Add additional fields, if needed.
}
// Release represents a project release.
type Release struct {
Tag string
URL string
Assets []ReleaseAsset
// TODO: add needed fields, e.g. Path.
}
// ReleaseAsset represents a release asset.
type ReleaseAsset struct {
Name string
URL string
}
// CIIBestPracticesData contains data foor CIIBestPractices check.
type CIIBestPracticesData struct {
Badge clients.BadgeLevel

View File

@ -42,7 +42,7 @@ func SignedReleases(name string, dl checker.DetailLogger, r *checker.SignedRelea
}
dl.Debug(&checker.LogMessage{
Text: fmt.Sprintf("GitHub release found: %s", release.Tag),
Text: fmt.Sprintf("GitHub release found: %s", release.TagName),
})
totalReleases++
@ -70,7 +70,7 @@ func SignedReleases(name string, dl checker.DetailLogger, r *checker.SignedRelea
dl.Warn(&checker.LogMessage{
Path: release.URL,
Type: checker.FileTypeURL,
Text: fmt.Sprintf("release artifact %s not signed", release.Tag),
Text: fmt.Sprintf("release artifact %s not signed", release.TagName),
})
}
if totalReleases >= releaseLookBack {

View File

@ -27,23 +27,7 @@ func SignedReleases(c *checker.CheckRequest) (checker.SignedReleasesData, error)
return checker.SignedReleasesData{}, fmt.Errorf("%w", err)
}
var results checker.SignedReleasesData
for i, r := range releases {
results.Releases = append(results.Releases,
checker.Release{
Tag: r.TagName,
URL: r.URL,
})
for _, asset := range r.Assets {
a := checker.ReleaseAsset{
URL: asset.URL,
Name: asset.Name,
}
results.Releases[i].Assets = append(results.Releases[i].Assets, a)
}
}
// Return raw results.
return results, nil
return checker.SignedReleasesData{
Releases: releases,
}, nil
}

View File

@ -278,7 +278,7 @@ func (r *jsonScorecardRawResult) addSignedReleasesRawResults(sr *checker.SignedR
for i, release := range sr.Releases {
r.Results.Releases = append(r.Results.Releases,
jsonRelease{
Tag: release.Tag,
Tag: release.TagName,
URL: release.URL,
})
for _, asset := range release.Assets {