aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/audit.rb
diff options
context:
space:
mode:
authorJack Nagel2011-11-18 15:22:04 -0600
committerJack Nagel2011-11-18 15:27:09 -0600
commit7e578477939a4e5dede2011ef4c43608a320982f (patch)
treedcd7af019f2e2a1664510342420e0b0c09cf2843 /Library/Homebrew/cmd/audit.rb
parent6c4d3a15d60d8f77f9b3280e93ec4eb0c6b10f8e (diff)
downloadbrew-7e578477939a4e5dede2011ef4c43608a320982f.tar.bz2
audit: check for ARGV.flag? in formulae
We don't want single letter options like '-v' or '-d' to unintentionally trigger formula-specific options. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library/Homebrew/cmd/audit.rb')
-rwxr-xr-xLibrary/Homebrew/cmd/audit.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb
index 035421081..b9d67bac6 100755
--- a/Library/Homebrew/cmd/audit.rb
+++ b/Library/Homebrew/cmd/audit.rb
@@ -120,6 +120,11 @@ def audit_formula_text name, text
problems << " * xcodebuild should be passed an explicit \"SYMROOT\""
end if strict?
+ # using ARGV.flag? for formula options is generally a bad thing
+ if text =~ /ARGV\.flag\?/
+ problems << " * Use 'ARGV.include?' instead of 'ARGV.flag?'"
+ end
+
return problems
end
@@ -128,7 +133,7 @@ def audit_formula_options f, text
# Find possible options
options = []
- text.scan(/ARGV\.(include|flag)\?[ ]*\(?(['"])(.+?)\2/) { |m| options << m[2] }
+ text.scan(/ARGV\.include\?[ ]*\(?(['"])(.+?)\1/) { |m| options << m[1] }
options.reject! {|o| o.include? "#"}
options.uniq!