From e717508b7b63b5bb0f84b2c62d3c621857baa67c Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Sun, 14 Sep 2014 15:43:20 -0500 Subject: audit: access the homepage attribute once --- Library/Homebrew/cmd/audit.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'Library') diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb index 6dd70cd67..78a65952b 100644 --- a/Library/Homebrew/cmd/audit.rb +++ b/Library/Homebrew/cmd/audit.rb @@ -181,19 +181,21 @@ class FormulaAuditor end def audit_urls - unless f.homepage =~ %r[^https?://] - problem "The homepage should start with http or https (url is #{f.homepage})." + homepage = f.homepage + + unless homepage =~ %r[^https?://] + problem "The homepage should start with http or https (URL is #{homepage})." end # Check for http:// GitHub homepage urls, https:// is preferred. # Note: only check homepages that are repo pages, not *.github.com hosts - if f.homepage =~ %r[^http://github\.com/] - problem "Use https:// URLs for homepages on GitHub (url is #{f.homepage})." + if homepage =~ %r[^http://github\.com/] + problem "Use https:// URLs for homepages on GitHub (URL is #{homepage})." end # Google Code homepages should end in a slash - if f.homepage =~ %r[^https?://code\.google\.com/p/[^/]+[^/]$] - problem "Google Code homepage should end with a slash (url is #{f.homepage})." + if homepage =~ %r[^https?://code\.google\.com/p/[^/]+[^/]$] + problem "Google Code homepage should end with a slash (URL is #{homepage})." end urls = @specs.map(&:url) -- cgit v1.2.3