Skip to content

Commit

Permalink
Remove releases from active check.
Browse files Browse the repository at this point in the history
  • Loading branch information
inferno-chromium committed Jan 5, 2021
1 parent b86fae0 commit 3c94ffa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 30 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ The following checks are all run against the target project:
| Pull-Requests | Does the project use [Pull Requests](https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/about-pull-requests) for all code changes? |
| Fuzzing | Does the project use fuzzing tools, e.g. [OSS-Fuzz](https://github.com/google/oss-fuzz)? |
| SAST | Does the project use static code analysis tools, e.g. [CodeQL](https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/enabling-code-scanning-for-a-repository#enabling-code-scanning-using-actions), [SonarCloud](https://sonarcloud.io)? |
| Active | Did the project get any commits and releases in last 90 days? |
| Active | Did the project get any commits in the last 90 days? |

To see detailed information on how each check works, see the [check-specific documentation page](checks.md).

Expand Down
30 changes: 1 addition & 29 deletions checks/active.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,7 @@ import (
var lookbackDays int = 90

func init() {
registerCheck("Active", IsActive)
}

func IsActive(c checker.Checker) checker.CheckResult {
return checker.MultiCheck(
PeriodicCommits,
PeriodicReleases,
)(c)
registerCheck("Active", PeriodicCommits)
}

func PeriodicCommits(c checker.Checker) checker.CheckResult {
Expand All @@ -55,27 +48,6 @@ func PeriodicCommits(c checker.Checker) checker.CheckResult {
c.Logf("commits in last %d days: %d", lookbackDays, totalCommits)
return checker.CheckResult{
Pass: totalCommits >= 2,
Confidence: 7,
}
}

func PeriodicReleases(c checker.Checker) checker.CheckResult {
releases, _, err := c.Client.Repositories.ListReleases(c.Ctx, c.Owner, c.Repo, &github.ListOptions{})
if err != nil {
return checker.RetryResult(err)
}

tz, _ := time.LoadLocation("UTC")
threshold := time.Now().In(tz).AddDate(0, 0, -1*lookbackDays)
totalReleases := 0
for _, r := range releases {
if r.GetCreatedAt().After(threshold) {
totalReleases++
}
}
c.Logf("releases in last %d days: %d", lookbackDays, totalReleases)
return checker.CheckResult{
Pass: totalReleases > 0,
Confidence: 10,
}
}

0 comments on commit 3c94ffa

Please sign in to comment.