audit: fix audit on formulae without homepages
This commit is contained in:
parent
ff93e1624b
commit
e3f4701f38
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user