audit: better handle formulae whitelisting.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
Mike McQuaid 2014-03-06 21:15:05 +00:00
parent 342ed1d163
commit 1fd8e7fd75

View File

@ -414,10 +414,8 @@ class FormulaAuditor
end end
# Avoid hard-coding compilers # 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)['" ]}
if line =~ %r{(system|ENV\[.+\]\s?=)\s?['"](/usr/bin/)?(gcc|llvm-gcc|clang)['" ]} problem "Use \"\#{ENV.cc}\" instead of hard-coding \"#{$3}\""
problem "Use \"\#{ENV.cc}\" instead of hard-coding \"#{$3}\""
end
end end
if line =~ %r{(system|ENV\[.+\]\s?=)\s?['"](/usr/bin/)?((g|llvm-g|clang)\+\+)['" ]} 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}\"" problem "No double 'without': Use `build.without? '#{$1}'` to check for \"--without-#{$1}\""
end end
# Mongo writes out a Ruby script that uses ARGV if line =~ /ARGV\.(?!(debug\?|verbose\?|value[\(\s]))/
# Python formulae need ARGV for Requirements # Python formulae need ARGV for Requirements
unless f.name == 'mongodb' || f.name == "pyobject3" problem "Use build instead of ARGV to check options",
if line =~ /ARGV\.(?!(debug\?|verbose\?|value[\(\s]))/ :whitelist => %w{pygobject3 qscintilla2}
problem "Use build instead of ARGV to check options"
end
end end
if line =~ /def options/ if line =~ /def options/
@ -538,7 +534,8 @@ class FormulaAuditor
private private
def problem p def problem p, options={}
return if options[:whitelist].to_a.include? f.name
@problems << p @problems << p
end end
end end