aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
authorMike McQuaid2014-03-06 21:15:05 +0000
committerMike McQuaid2014-03-08 00:54:35 +0000
commit1fd8e7fd75dbaffab57d6fdf84170a367f41c425 (patch)
tree76a5c8a8bb234e83ab3c2b1f30759af46e53437b /Library/Homebrew/cmd
parent342ed1d163c2ab321a9ce3522111bce59ef1fd2b (diff)
downloadbrew-1fd8e7fd75dbaffab57d6fdf84170a367f41c425.tar.bz2
audit: better handle formulae whitelisting.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/audit.rb19
1 files changed, 8 insertions, 11 deletions
diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb
index 34c4a624b..99c957b4b 100644
--- a/Library/Homebrew/cmd/audit.rb
+++ b/Library/Homebrew/cmd/audit.rb
@@ -414,10 +414,8 @@ class FormulaAuditor
end
# Avoid hard-coding compilers
- unless f.name == 'go' # Go needs to set CC for cgo support.
- if line =~ %r{(system|ENV\[.+\]\s?=)\s?['"](/usr/bin/)?(gcc|llvm-gcc|clang)['" ]}
- problem "Use \"\#{ENV.cc}\" instead of hard-coding \"#{$3}\""
- end
+ if line =~ %r{(system|ENV\[.+\]\s?=)\s?['"](/usr/bin/)?(gcc|llvm-gcc|clang)['" ]}
+ problem "Use \"\#{ENV.cc}\" instead of hard-coding \"#{$3}\""
end
if line =~ %r{(system|ENV\[.+\]\s?=)\s?['"](/usr/bin/)?((g|llvm-g|clang)\+\+)['" ]}
@@ -444,12 +442,10 @@ class FormulaAuditor
problem "No double 'without': Use `build.without? '#{$1}'` to check for \"--without-#{$1}\""
end
- # Mongo writes out a Ruby script that uses ARGV
- # Python formulae need ARGV for Requirements
- unless f.name == 'mongodb' || f.name == "pyobject3"
- if line =~ /ARGV\.(?!(debug\?|verbose\?|value[\(\s]))/
- problem "Use build instead of ARGV to check options"
- end
+ if line =~ /ARGV\.(?!(debug\?|verbose\?|value[\(\s]))/
+ # Python formulae need ARGV for Requirements
+ problem "Use build instead of ARGV to check options",
+ :whitelist => %w{pygobject3 qscintilla2}
end
if line =~ /def options/
@@ -538,7 +534,8 @@ class FormulaAuditor
private
- def problem p
+ def problem p, options={}
+ return if options[:whitelist].to_a.include? f.name
@problems << p
end
end