audit: recognize options used with 'ARGV.flag?'

A few formula use ARGV.flag? instead of ARGV.include?. This made `audit`
recognize a few undocumented instances of a '--devel' option, but we can
just ignore that like '--HEAD' for now, and change the behavior if we
decide they need to be documented explicitly in each formula.

cf. Homebrew/homebrew#7456.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
Jack Nagel 2011-09-21 15:22:05 -05:00
parent d817e5e51e
commit 51f010ac39

View File

@ -124,7 +124,7 @@ def audit_formula_options f, text
# Find possible options # Find possible options
options = [] options = []
text.scan(/ARGV\.include\?[ ]*\(?(['"])(.+?)\1/) { |m| options << m[1] } text.scan(/ARGV\.(include|flag)\?[ ]*\(?(['"])(.+?)\2/) { |m| options << m[2] }
options.reject! {|o| o.include? "#"} options.reject! {|o| o.include? "#"}
options.uniq! options.uniq!
@ -140,7 +140,7 @@ def audit_formula_options f, text
if options.length > 0 if options.length > 0
options.each do |o| options.each do |o|
next if o == '--HEAD' next if o == '--HEAD' || o == '--devel'
problems << " * Option #{o} is not documented" unless documented_options.include? o problems << " * Option #{o} is not documented" unless documented_options.include? o
end end
end end