lib/review/preprocessor.rb in review-4.2.0 vs lib/review/preprocessor.rb in review-5.0.0
- old
+ new
@@ -193,11 +193,11 @@
m = /\A\#@(\w+)\((.*?)\)(?:\[(.*?)\])?\z/.match(line.strip) or
error "wrong directive: #{line.strip}"
op = m[1]
args = m[2].split(/,\s*/)
opts = parse_optargs(m[3])
- return if argc == 0 and args.empty?
+ return if (argc == 0) && args.empty?
if argc == -1
# Any number of arguments are allowed.
elsif args.size != argc
error 'wrong arg size'
end
@@ -282,11 +282,11 @@
out.concat(stderr.readlines)
else
err = stderr.readlines
end
end
- if err and !err.empty?
+ if err && !err.empty?
$stderr.puts '[unexpected stderr message]'
err.each { |line| $stderr.print line }
error 'get_output: got unexpected output'
end
num = 0
@@ -353,18 +353,18 @@
fname.start_with?('git|')
end
def parse_git_blob(g_obj)
IO.popen('git show ' + g_obj.sub(/\Agit\|/, ''), 'r') do |f|
- init_errorutils f
+ init_errorutils(f)
return _parse_file(f)
end
end
def parse_file(fname)
File.open(fname, 'rt:BOM|utf-8') do |f|
- init_errorutils f
+ init_errorutils(f)
return _parse_file(f)
end
end
def _parse_file(f)
@@ -424,10 +424,10 @@
when /\A\#@-/ # does not increment line number.
line = canonical($')
curr.each_value { |list| list.push(Line.new(nil, line)) }
else
- next if yacchack and line.strip == ';'
+ next if yacchack && (line.strip == ';')
line = canonical(line)
curr.each_value { |list| list.push(Line.new(lineno, line)) }
lineno += 1
end
end