diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb index b5e5159298..a7376c8036 100755 --- a/Library/Homebrew/cmd/audit.rb +++ b/Library/Homebrew/cmd/audit.rb @@ -125,16 +125,31 @@ def audit_formula_text name, text return problems end +INSTALL_OPTIONS = %W[ + --build-from-source + --debug + --devel + --force + --fresh + --HEAD + --ignore-dependencies + --interactive + --use-clang + --use-gcc + --use-llvm + --verbose +].freeze + def audit_formula_options f, text problems = [] - # Find possible options + # Textually find options checked for in the formula options = [] text.scan(/ARGV\.include\?[ ]*\(?(['"])(.+?)\1/) { |m| options << m[1] } options.reject! {|o| o.include? "#"} - options.uniq! + options.uniq! # May be checked more than once - # Find documented options + # Find declared options begin opts = f.options documented_options = [] @@ -156,6 +171,9 @@ def audit_formula_options f, text next if o == '--universal' and text =~ /ARGV\.build_universal\?/ next if o == '--32-bit' and text =~ /ARGV\.build_32_bit\?/ problems << " * Option #{o} is unused" unless options.include? o + if INSTALL_OPTIONS.include? o + problems << " * Option #{o} shadows an install option; should be renamed" + end end end