Use regex in brew-audit and add path concat test.

This commit is contained in:
Adam Vandenberg 2010-07-12 10:34:12 -07:00
parent 984d0bd05d
commit 2bac03ef92

View File

@ -14,18 +14,25 @@ def ff
end end
ff.each do |f| ff.each do |f|
text = ""
File.open(f.path, "r") { |afile| text = afile.read }
problems = [] problems = []
unless `grep "# depends_on 'cmake'" "#{f.path}"`.strip.empty? if /# depends_on 'cmake'/ =~ text
problems << " * Commented cmake support still in #{f.name}" problems << " * Commented cmake support found."
end end
unless `grep "\?use_mirror=" "#{f.path}"`.strip.empty? if /\?use_mirror=/ =~ text
problems << " * Remove 'use_mirror' from url for #{f.name}" problems << " * Remove 'use_mirror' from url."
end
if /(#\{\w+\s*\+\s*['"][^}]+\})/ =~ text
problems << " * Try not to concatenate paths in string interpolation:\n #{$1}"
end end
unless problems.empty? unless problems.empty?
puts "#{f.name}:" puts "#{f.name}:"
puts problems * '\n' puts problems * "\n"
puts puts
end end
end end