Skip to content

Commit

Permalink
comment
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentsimon committed Apr 1, 2022
1 parent f07a8fd commit fb84bcf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion checks/cii_best_practices.go
Expand Up @@ -32,7 +32,7 @@ func init() {
}
}

// CodeReview will check if the maintainers perform code review.
// CheckCIIBestPractices will check if the maintainers has a CII badge.
func CIIBestPractices(c *checker.CheckRequest) checker.CheckResult {
rawData, err := raw.CIIBestPractices(c)
if err != nil {
Expand Down
23 changes: 8 additions & 15 deletions pkg/json_raw_results.go
Expand Up @@ -119,17 +119,13 @@ type jsonIssue struct {
// TODO: add fields, e.g., state=[opened|closed]
}

type jsonRawResults struct {
// List of recent issues.
RecentIssues []jsonIssue `json:"issues"`
// List of vulnerabilities.
}

type jsonOssfBestPractices struct {
Badge string `json:"badge"`
}

type jsonRawResults struct {
// Issues.
RecentIssues []jsonIssue `json:"issues"`
// OSSF best practices badge.
OssfBestPractices jsonOssfBestPractices `json:"openssf-best-practices-badge"`
// Vulnerabilities.
Expand Down Expand Up @@ -208,15 +204,6 @@ func (r *jsonScorecardRawResult) setDefaultCommitData(commits []checker.DefaultB
return nil
}


//nolint:unparam
func (r *jsonScorecardRawResult) addOssfBestPracticesRawResults(cbp *checker.CIIBestPracticesData) error {
r.Results.OssfBestPractices.Badge = string(cbp.Badge)
return nil
}

//nolint:unparam
func (r *jsonScorecardRawResult) addCodeReviewRawResults(cr *checker.CodeReviewData) error {
r.Results.DefaultBranchCommits = []jsonDefaultBranchCommit{}
for _, commit := range commits {
com := jsonDefaultBranchCommit{
Expand Down Expand Up @@ -262,6 +249,12 @@ func (r *jsonScorecardRawResult) addCodeReviewRawResults(cr *checker.CodeReviewD
return nil
}

//nolint:unparam
func (r *jsonScorecardRawResult) addOssfBestPracticesRawResults(cbp *checker.CIIBestPracticesData) error {
r.Results.OssfBestPractices.Badge = string(cbp.Badge)
return nil
}

func (r *jsonScorecardRawResult) addCodeReviewRawResults(cr *checker.CodeReviewData) error {
return r.setDefaultCommitData(cr.DefaultBranchCommits)
}
Expand Down

0 comments on commit fb84bcf

Please sign in to comment.