Skip to content

Commit 17fb48e

Browse files
committed
Refactor check_nokogiri in msftidy
1 parent 2ce6f32 commit 17fb48e

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

tools/msftidy.rb

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,17 +125,15 @@ def check_nokogiri
125125
has_nokogiri = false
126126
has_nokogiri_xml_parser = false
127127
@source.each_line do |line|
128-
if line =~ /^\s*(require|load)\s+['"]nokogiri['"]/
129-
has_nokogiri = true
130-
break
131-
end
132-
end
133-
if has_nokogiri
134-
@source.each_line do |line|
135-
if line =~ /Nokogiri::XML.parse/ or line =~ /Nokogiri::XML::Reader/
128+
if has_nokogiri
129+
if line =~ /Nokogiri::XML\.parse/ or line =~ /Nokogiri::XML::Reader/
136130
has_nokogiri_xml_parser = true
137131
break
138132
end
133+
else
134+
if line =~ /^\s*(require|load)\s+['"]nokogiri['"]/
135+
has_nokogiri = true
136+
end
139137
end
140138
end
141139
error(msg) if has_nokogiri_xml_parser

0 commit comments

Comments
 (0)