diff options
| author | Mike McQuaid | 2015-07-08 14:22:44 +0100 |
|---|---|---|
| committer | Mike McQuaid | 2015-07-08 14:53:48 +0100 |
| commit | 51a1792e7ad4946940089a68112af783faa8a16c (patch) | |
| tree | 7896fc9637f4686f874b8fbbe37cdcd25335a47e /Library/Homebrew/cmd | |
| parent | 48df76dc894370f902b02bf495a8b2c0dc021823 (diff) | |
| download | brew-51a1792e7ad4946940089a68112af783faa8a16c.tar.bz2 | |
Audit GitHub repository notability.
This stuff seems to be taken better when coming from a script rather
than from a human. Feel free to disagree about the specific numbers
chosen here.
Diffstat (limited to 'Library/Homebrew/cmd')
| -rw-r--r-- | Library/Homebrew/cmd/audit.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb index 3ef601c3b..bacd8b0e3 100644 --- a/Library/Homebrew/cmd/audit.rb +++ b/Library/Homebrew/cmd/audit.rb @@ -422,6 +422,26 @@ class FormulaAuditor end end + def audit_github_repository + return unless @strict + + regex = %r{https?://github.com/([^/]+)/([^/]+)/?.*} + _, user, repo = *regex.match(formula.stable.url) + _, user, repo = *regex.match(formula.homepage) unless user + return if !user || !repo + + metadata = GitHub.repository(user, repo) + problem "GitHub fork (not canonical repository)" if metadata["fork"] + if (metadata["forks_count"] < 5) || (metadata["watchers_count"] < 5) || + (metadata["stargazers_count"] < 10) + problem "GitHub repository not notable enough (<5 forks, <5 watchers and/or <10 stars)" + end + + if (Date.parse(metadata["created_at"]) > (Date.today - 30)) + problem "GitHub repository too new (<30 days old)" + end + end + def audit_specs if head_only?(formula) && formula.tap.to_s.downcase != "homebrew/homebrew-head-only" problem "Head-only (no stable download)" @@ -831,6 +851,7 @@ class FormulaAuditor audit_specs audit_desc audit_homepage + audit_github_repository audit_deps audit_conflicts audit_options |
