brew audit - most audits shouldn't happen against __END__

This commit is contained in:
Adam Vandenberg 2010-08-10 11:52:03 -07:00
parent c5a9520310
commit b12cc1eb0a

View File

@ -52,14 +52,8 @@ def audit_formula_text text
problems << " * md5 is empty" problems << " * md5 is empty"
end end
# DATA with no __END__ # No trailing whitespace, please
if (text =~ /\bDATA\b/) and not (text =~ /^\s*__END__\s*$/) if text =~ /[ ]+$/
problems << " * 'DATA' was found, but no '__END__'"
end
# Don't complain about spaces in patches
split_patch = (text.split("__END__")[0]).strip()
if split_patch =~ /[ ]+$/
problems << " * Trailing whitespace was found." problems << " * Trailing whitespace was found."
end end
@ -79,7 +73,15 @@ def audit_some_formulae
text = "" text = ""
File.open(f.path, "r") { |afile| text = afile.read } File.open(f.path, "r") { |afile| text = afile.read }
problems += audit_formula_text(text) # DATA with no __END__
if (text =~ /\bDATA\b/) and not (text =~ /^\s*__END__\s*$/)
problems << " * 'DATA' was found, but no '__END__'"
end
# Don't try remaining audits on text in __END__
text_without_patch = (text.split("__END__")[0]).strip()
problems += audit_formula_text(text_without_patch)
unless problems.empty? unless problems.empty?
puts "#{f.name}:" puts "#{f.name}:"