MCPcopy
hub / github.com/ossf/scorecard / uniqueReviewers

Function uniqueReviewers

probes/codeReviewOneReviewers/impl.go:122–133  ·  view source on GitHub ↗

Loops through the reviews of a changeset, returning the number or unique user logins are present. Reviews performed by the author don't count, and an error is returned if a reviewer login can't be retrieved.

(changesetAuthor string, reviews []clients.Review)

Source from the content-addressed store, hash-verified

120// Loops through the reviews of a changeset, returning the number or unique user logins are present.
121// Reviews performed by the author don't count, and an error is returned if a reviewer login can't be retrieved.
122func uniqueReviewers(changesetAuthor string, reviews []clients.Review) (int, error) {
123 reviewersList := make(map[string]bool)
124 for i := range reviews {
125 if reviews[i].Author.Login == "" {
126 return 0, ErrReviewerLogin
127 }
128 if !reviewersList[reviews[i].Author.Login] && reviews[i].Author.Login != changesetAuthor {
129 reviewersList[reviews[i].Author.Login] = true
130 }
131 }
132 return len(reviewersList), nil
133}

Callers 1

codeReviewRunFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected