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>
This commit is contained in:
parent
6c4d3a15d6
commit
7e57847793
@ -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!
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user