From be984215c9b37f025dae36866382a26753f27cc9 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Tue, 23 Jul 2013 11:21:37 -0500 Subject: [PATCH] audit: fix dep name escaping --- Library/Homebrew/cmd/audit.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb index a49d01e06c..3f3e6f56cf 100644 --- a/Library/Homebrew/cmd/audit.rb +++ b/Library/Homebrew/cmd/audit.rb @@ -511,12 +511,14 @@ class FormulaAuditor end def audit_conditional_dep(dep, condition, line) - dep = Regexp.escape(dep) + quoted_dep = quote_dep(dep) + dep = Regexp.escape(dep.to_s) + case condition when /if build\.include\? ['"]with-#{dep}['"]$/, /if build\.with\? ['"]#{dep}['"]$/ - problem %{Replace #{line.inspect} with "depends_on #{quote_dep(dep)} => :optional"} + problem %{Replace #{line.inspect} with "depends_on #{quoted_dep} => :optional"} when /unless build\.include\? ['"]without-#{dep}['"]$/, /unless build\.without\? ['"]#{dep}['"]$/ - problem %{Replace #{line.inspect} with "depends_on #{quote_dep(dep)} => :recommended"} + problem %{Replace #{line.inspect} with "depends_on #{quoted_dep} => :recommended"} end end