audit: fix audit on formulae without homepages

This commit is contained in:
Misty De Meo 2017-02-26 16:49:09 +11:00
parent ff93e1624b
commit e3f4701f38
2 changed files with 16 additions and 0 deletions

View File

@ -605,6 +605,11 @@ class FormulaAuditor
def audit_homepage def audit_homepage
homepage = formula.homepage homepage = formula.homepage
if homepage.nil? || homepage.empty?
problem "Formula should have a homepage."
return
end
unless homepage =~ %r{^https?://} unless homepage =~ %r{^https?://}
problem "The homepage should start with http or https (URL is #{homepage})." problem "The homepage should start with http or https (URL is #{homepage})."
end end

View File

@ -466,6 +466,17 @@ class FormulaAuditorTests < Homebrew::TestCase
end end
end end
def test_audit_without_homepage
fa = formula_auditor "foo", <<-EOS.undent, online: true
class Foo < Formula
url "http://example.com/foo-1.0.tgz"
end
EOS
fa.audit_homepage
assert_match "Formula should have a homepage.", fa.problems.first
end
def test_audit_xcodebuild_suggests_symroot def test_audit_xcodebuild_suggests_symroot
fa = formula_auditor "foo", <<-EOS.undent fa = formula_auditor "foo", <<-EOS.undent
class Foo < Formula class Foo < Formula