audit: fix dep name escaping

This commit is contained in:
Jack Nagel 2013-07-23 11:21:37 -05:00
parent a3863394c0
commit be984215c9

View File

@ -511,12 +511,14 @@ class FormulaAuditor
end end
def audit_conditional_dep(dep, condition, line) def audit_conditional_dep(dep, condition, line)
dep = Regexp.escape(dep) quoted_dep = quote_dep(dep)
dep = Regexp.escape(dep.to_s)
case condition case condition
when /if build\.include\? ['"]with-#{dep}['"]$/, /if build\.with\? ['"]#{dep}['"]$/ 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}['"]$/ 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
end end