scorecard/checks/fuzzing.go
Abhishek Arya 6e5ce52cae
Fix filenames to match check names, remove unneeded repos.txt. (#15)
* Fix filenames to match check names, remove unneeded repos.txt.

* Fix conflict.

* Minor fix.
2020-10-16 13:22:28 -05:00

40 lines
698 B
Go

package checks
import (
"fmt"
"strings"
"github.com/dlorenc/scorecard/checker"
)
//go:generate ../gen_github.sh
var ossFuzzRepos map[string]struct{}
func init() {
ossFuzzRepos = map[string]struct{}{}
for _, r := range strings.Split(fuzzRepos, "\n") {
if r == "" {
continue
}
r = strings.TrimSuffix(r, ".git")
ossFuzzRepos[r] = struct{}{}
}
registerCheck("Fuzzing", Fuzzing)
}
func Fuzzing(c checker.Checker) checker.CheckResult {
url := fmt.Sprintf("github.com/%s/%s", c.Owner, c.Repo)
if _, ok := ossFuzzRepos[url]; ok {
return checker.CheckResult{
Pass: true,
Confidence: 10,
}
}
return checker.CheckResult{
Pass: false,
Confidence: 3,
}
}