bin/review-check in review-5.3.0 vs bin/review-check in review-5.4.0
- old
+ new
@@ -16,11 +16,11 @@
include ReVIEW::TextUtils
def sigmain
Signal.trap(:INT) { exit 1 }
- if RUBY_PLATFORM !~ /mswin(?!ce)|mingw|cygwin|bccwin/
+ unless RUBY_PLATFORM.match?(/mswin(?!ce)|mingw|cygwin|bccwin/)
Signal.trap(:PIPE, 'IGNORE')
end
main
rescue Errno::EPIPE
exit 0
@@ -93,20 +93,20 @@
end
def find_line(lines, re)
# single line?
lines.each_with_index do |line, idx|
- if re =~ line
+ if re&.match?(line)
return line.gsub(re, '<<<\&>>>'), idx
end
end
# multiple lines?
i = 0
while i < lines.size - 1
str = lines[i] + lines[i + 1]
- return str.gsub(re, '<<<\&>>>'), i if re =~ str
+ return str.gsub(re, '<<<\&>>>'), i if re&.match?(str)
i += 1
end
raise 'must not happen'
@@ -116,11 +116,11 @@
words = []
nega = []
File.foreach(rc) do |line|
next if line[0, 1] == '#'
- if / !/ =~ line
+ if / !/.match?(line)
line, n = *line.split('!', 2)
nega.push(n.strip)
end
words.push(line.strip)
end
@@ -139,20 +139,20 @@
next
when %r{\A//caption\{(.*?)//\}}
yield [$1], f.filename, f.lineno
when %r<\A//\w.*\{\s*\z>
while line = f.gets
- break if %r{//\}} === line
+ break if %r{//\}}.match?(line)
end
when /\A=/
yield [line.slice(/\A=+(?:\[.*?\])?\s+(.*)/, 1).strip], f.lineno
else
buf = [line.strip]
lineno = f.lineno
while line = f.gets
break if line.strip.empty?
- break if %r{\A(?:=|//[\w\}])} =~ line
- next if /\A\#@/ =~ line
+ break if %r{\A(?:=|//[\w\}])}.match?(line)
+ next if /\A\#@/.match?(line)
buf.push(line.strip)
end
yield buf, lineno
@review_utils_word_ok = nil