aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2012-03-17 08:45:51 -0700
committerAdam Vandenberg2012-03-17 08:46:04 -0700
commit8f47bdb782e3d6d5d1bfa39910197d5a7975c7d4 (patch)
treecbd3fe1792397fedb51385411d96b3645e7fbd5a /Library
parent5141c9cadddf0ca0ff03bb39b3e7a24177e56fe9 (diff)
downloadbrew-8f47bdb782e3d6d5d1bfa39910197d5a7975c7d4.tar.bz2
audit: check for install options being shadowed
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/Homebrew/cmd/audit.rb24
1 files changed, 21 insertions, 3 deletions
diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb
index b5e515929..a7376c803 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