Skip to content

Commit

Permalink
Merge pull request #1424 from kmuto/rubocopv0770
Browse files Browse the repository at this point in the history
follow RuboCop 0.77.0
  • Loading branch information
kmuto authored Dec 8, 2019
2 parents 3b02f33 + 811a483 commit ef43a3f
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
14 changes: 7 additions & 7 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Style/MutableConstant:
#Style/MultipleComparison:
# Enabled: true

Style/UnneededInterpolation:
Style/RedundantInterpolation:
Enabled: true

Performance/RedundantMerge:
Expand Down Expand Up @@ -301,7 +301,7 @@ Style/TrailingCommaInHashLiteral:
Style/WordArray:
MinSize: 10

Style/UnneededPercentQ:
Style/RedundantPercentQ:
Enabled: false

Style/WhileUntilModifier:
Expand All @@ -316,7 +316,7 @@ Layout/BlockAlignment:
Enabled: true

Layout/EndAlignment:
Enabled: AlignWith
Enabled: true

Layout/MultilineMethodCallBraceLayout:
Enabled: true
Expand Down Expand Up @@ -362,10 +362,10 @@ Layout/IndentationConsistency:
Layout/IndentationWidth:
Enabled: true

Layout/IndentFirstHashElement:
Layout/FirstHashElementIndentation:
Enabled: true

Layout/IndentHeredoc:
Layout/HeredocIndentation:
Enabled: false

Layout/LeadingCommentSpace:
Expand Down Expand Up @@ -412,7 +412,7 @@ Layout/SpaceInsideStringInterpolation:
EnforcedStyle: no_space
Enabled: true

Layout/TrailingBlankLines:
Layout/TrailingEmptyLines:
Enabled: true

Layout/TrailingWhitespace:
Expand Down Expand Up @@ -492,7 +492,7 @@ Naming/MemoizedInstanceVariableName:
Naming/MethodName:
Enabled: true

Naming/UncommunicativeMethodParamName:
Naming/MethodParameterName:
Enabled: false

# Use snake_case for variable names.
Expand Down
2 changes: 1 addition & 1 deletion bin/review-compile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def _main
@logger = ReVIEW.logger
@mode = :files
@basedir = nil
if /\Areview2/ =~ File.basename($PROGRAM_NAME)
if File.basename($PROGRAM_NAME).start_with?('review2')
@target = File.basename($PROGRAM_NAME, '.rb').sub('review2', '')
else
@target = nil
Expand Down
2 changes: 1 addition & 1 deletion bin/review-validate
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ARGF.each do |line|
@logger.warn "#{ln}: block #{new_block} started, but previous block #{block} didn't close yet."
end
block = new_block
elsif line =~ %r{\A//\}}
elsif line.start_with?('//}')
if block.nil?
@logger.warn "#{ln}: block ended, but not opened."
end
Expand Down
2 changes: 1 addition & 1 deletion lib/review/book/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ def read_file(filename)
res = ''
File.open(filename_join(@basedir, filename), 'rt:BOM|utf-8') do |f|
f.each_line do |line|
next if /\A#/ =~ line
next if line.start_with?('#')
line.gsub!(/#.*\Z/, '')
res << line
end
Expand Down
4 changes: 2 additions & 2 deletions lib/review/book/index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def self.parse(src, *args)
# ex. ["//image", "id", "", "caption"]
elements = line.split(/\[(.*?)\]/)
if elements[1].present?
if line =~ %r{\A//imgtable}
if line.start_with?('//imgtable')
items.push(ReVIEW::Book::Index::Item.new(elements[1], 0, elements[3]))
else ## %r<\A//(image|graph)>
items.push(ReVIEW::Book::Index::Item.new(elements[1], seq, elements[3]))
Expand Down Expand Up @@ -267,7 +267,7 @@ def self.parse(src, chap)
if line =~ %r{\A//[a-z]+.*\{\Z}
inside_block = true
next
elsif line =~ %r{\A//\}}
elsif line.start_with?('//}')
inside_block = nil
next
elsif inside_block
Expand Down
2 changes: 1 addition & 1 deletion lib/review/compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ def read_block(f, ignore_inline)
buf.push(text(line.rstrip, true))
end
end
unless %r{\A//\}} =~ f.peek
unless f.peek.to_s.start_with?('//}')
error "unexpected EOF (block begins at: #{head})"
return buf
end
Expand Down
2 changes: 1 addition & 1 deletion lib/review/init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def extract_archive(dir, filename, originalfilename)
next
end

if fname =~ %r{\A/} || fname =~ /\.\./ # simple fool proof
if fname.start_with?('/') || fname =~ /\.\./ # simple fool proof
made = nil
break
end
Expand Down
4 changes: 2 additions & 2 deletions lib/review/tocparser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def parse(f, chap)
node_stack.push(dummy_chapter)
roots.push(dummy_chapter)
end
next if label =~ %r{\A\[/} # ex) "[/column]"
next if label.start_with?('[/') # ex) "[/column]"
sec = Section.new(lev, label.gsub(/\A\{.*?\}\s?/, ''))
node_stack.pop until node_stack.last.level < sec.level
node_stack.last.add_child(sec)
Expand All @@ -73,7 +73,7 @@ def parse(f, chap)
beg = f.lineno
list.add(line)
while line = f.gets
break if %r{\A//\}} =~ line
break if line.start_with?('//}')
list.add(line)
end
error!(filename, beg, 'unterminated list') unless line
Expand Down
2 changes: 1 addition & 1 deletion review.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Gem::Specification.new do |gem|
gem.add_dependency('rubyzip')
gem.add_development_dependency('pygments.rb')
gem.add_development_dependency('rake')
gem.add_development_dependency('rubocop', '~> 0.72.0')
gem.add_development_dependency('rubocop', '~> 0.77.0')
gem.add_development_dependency('rubocop-performance')
gem.add_development_dependency('simplecov')
gem.add_development_dependency('test-unit')
Expand Down

0 comments on commit ef43a3f

Please sign in to comment.