Refactor check_nokogiri in msftidy

bug/bundler_fix
William Vu 2014-05-29 13:06:47 -05:00
parent 2ce6f325f5
commit 17fb48eaa3
No known key found for this signature in database
GPG Key ID: E761DCB4C1629024
1 changed files with 6 additions and 8 deletions

View File

@ -125,17 +125,15 @@ class Msftidy
has_nokogiri = false
has_nokogiri_xml_parser = false
@source.each_line do |line|
if line =~ /^\s*(require|load)\s+['"]nokogiri['"]/
has_nokogiri = true
break
end
end
if has_nokogiri
@source.each_line do |line|
if line =~ /Nokogiri::XML.parse/ or line =~ /Nokogiri::XML::Reader/
if has_nokogiri
if line =~ /Nokogiri::XML\.parse/ or line =~ /Nokogiri::XML::Reader/
has_nokogiri_xml_parser = true
break
end
else
if line =~ /^\s*(require|load)\s+['"]nokogiri['"]/
has_nokogiri = true
end
end
end
error(msg) if has_nokogiri_xml_parser