aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Vandenberg2010-08-10 11:52:03 -0700
committerAdam Vandenberg2010-08-10 11:52:03 -0700
commit4d8790370f521254939db5348792abc96432cf58 (patch)
tree789092e6b87b060396b540b6dc0471a007c52393
parente8fa13dafc6e13200eb176b748c80a6d853960e3 (diff)
downloadhomebrew-4d8790370f521254939db5348792abc96432cf58.tar.bz2
brew audit - most audits shouldn't happen against __END__
-rwxr-xr-xLibrary/Contributions/examples/brew-audit.rb20
1 files changed, 11 insertions, 9 deletions
diff --git a/Library/Contributions/examples/brew-audit.rb b/Library/Contributions/examples/brew-audit.rb
index 7e28e99d5..84334a95b 100755
--- a/Library/Contributions/examples/brew-audit.rb
+++ b/Library/Contributions/examples/brew-audit.rb
@@ -52,14 +52,8 @@ def audit_formula_text text
problems << " * md5 is empty"
end
- # DATA with no __END__
- if (text =~ /\bDATA\b/) and not (text =~ /^\s*__END__\s*$/)
- 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 =~ /[ ]+$/
+ # No trailing whitespace, please
+ if text =~ /[ ]+$/
problems << " * Trailing whitespace was found."
end
@@ -79,7 +73,15 @@ def audit_some_formulae
text = ""
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?
puts "#{f.name}:"