aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorJack Nagel2012-01-25 22:41:53 -0600
committerJack Nagel2012-01-25 22:41:53 -0600
commitab19242d0484a91ca2b9dac28c8a131be08758d6 (patch)
tree8f191cbb3f31b66b0a47601b8b45680124ef5bfe /Library/Homebrew
parentc36561f4503da5ec7833e301b997fef4082e7dd5 (diff)
downloadbrew-ab19242d0484a91ca2b9dac28c8a131be08758d6.tar.bz2
audit: reorganize some checks
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library/Homebrew')
-rwxr-xr-xLibrary/Homebrew/cmd/audit.rb42
1 files changed, 29 insertions, 13 deletions
diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb
index a1a86d2c0..0910d207f 100755
--- a/Library/Homebrew/cmd/audit.rb
+++ b/Library/Homebrew/cmd/audit.rb
@@ -199,6 +199,11 @@ def audit_formula_urls f
problems << " * The homepage should start with http or https."
end
+ # Google Code homepages should end in a slash
+ if f.homepage =~ %r[^https?://code\.google\.com/p/[^/]+[^/]$]
+ problems << " * Google Code homepage should end with a slash."
+ end
+
urls = [(f.url rescue nil), (f.head rescue nil)].reject {|p| p.nil?}
urls.uniq! # head-only formulae result in duplicate entries
@@ -251,6 +256,24 @@ def audit_formula_urls f
return problems
end
+def audit_formula_specs text
+ problems = []
+
+ if text =~ /devel .+(url '.+').+(url '.+')/m
+ problems << " * 'devel' block found before stable 'url'"
+ end
+
+ if text =~ /devel .+(head '.+')/m
+ problems << " * 'devel' block found before 'head'"
+ end
+
+ if text =~ /devel do\s+end/
+ problems << " * Empty 'devel' block found"
+ end
+
+ return problems
+end
+
def audit_formula_instance f
problems = []
@@ -275,10 +298,7 @@ def audit_formula_instance f
end
end
- # Google Code homepages should end in a slash
- if f.homepage =~ %r[^https?://code\.google\.com/p/[^/]+[^/]$]
- problems << " * Google Code homepage should end with a slash."
- end
+ problems += [' * invalid or missing version'] if f.version.to_s.empty?
return problems
end
@@ -310,15 +330,10 @@ module Homebrew extend self
problems << " * 'DATA' was found, but no '__END__'"
end
- problems << " * File should end with a newline" if text =~ /.+\z/
-
- problems += [' * invalid or missing version'] if f.version.to_s.empty?
-
- problems << " * 'devel' block found before stable 'url'" if text =~ /devel .+(url '.+').+(url '.+')/m
-
- problems << " * 'devel' block found before 'head'" if text =~ /devel .+(head '.+')/m
-
- problems << " * Empty 'devel' block found" if text =~ /devel do\s+end/
+ # files should end with a newline
+ if text =~ /.+\z/
+ problems << " * File should end with a newline"
+ end
# Don't try remaining audits on text in __END__
text_without_patch = (text.split("__END__")[0]).strip()
@@ -326,6 +341,7 @@ module Homebrew extend self
problems += audit_formula_text(f.name, text_without_patch)
problems += audit_formula_options(f, text_without_patch)
problems += audit_formula_version(f, text_without_patch)
+ problems += audit_formula_specs(text_without_patch)
unless problems.empty?
errors = true