Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apply rubocop 1.59.0. Drop Ruby 2.7 and add 3.3 #1905

Merged
merged 3 commits into from
Jan 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ['2.7', '3.0', '3.1', '3.2']
ruby: ['3.0', '3.1', '3.2', '3.3']
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ruby-tex.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ['2.7', '3.2']
os: [ubuntu-20.04]
ruby: ['3.2']
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v2
- name: Install TeXLive 2020 in ubuntu
- name: Install TeXLive 2021 in ubuntu
if: runner.os == 'Linux'
run: |
sudo apt-get update -y -qq && sudo apt-get install -y -qq texlive-lang-japanese texlive-fonts-recommended texlive-fonts-extra texlive-luatex texlive-extra-utils texlive-latex-extra dvipng poppler-utils
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ruby-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [ '3.2', '3.1', '3.0', '2.7' ]
ruby: [ '3.3', '3.2', '3.1', '3.0' ]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ['2.7', '3.0', '3.1', '3.2']
ruby: ['3.0', '3.1', '3.2', '3.3']
os: [ubuntu-latest, macOS-latest]
steps:
- uses: actions/checkout@v2
Expand Down
5 changes: 4 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ AllCops:
- tmp/*
DisplayCopNames: true
NewCops: enable
TargetRubyVersion: 2.7
TargetRubyVersion: 3.0

require:
- rubocop-performance
Expand Down Expand Up @@ -41,6 +41,9 @@ Performance/CollectionLiteralInLoop:
Performance/MapCompact:
Enabled: false

Performance/StringIdentifierArgument:
Enabled: false

#### Style

Style/AsciiComments:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@ Exception:

## Copyright

Copyright (c) 2006-2023 Minero Aoki, Kenshi Muto, Masayoshi Takahashi, Masanori Kado.
Copyright (c) 2006-2024 Minero Aoki, Kenshi Muto, Masayoshi Takahashi, Masanori Kado.
14 changes: 7 additions & 7 deletions lib/review/builder.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2002-2023 Minero Aoki, Kenshi Muto
# Copyright (c) 2002-2024 Minero Aoki, Kenshi Muto
#
# This program is free software.
# You can distribute or modify this program under the terms of
Expand Down Expand Up @@ -133,7 +133,7 @@ def puts(*s)
end

def target_name
self.class.to_s.gsub(/ReVIEW::/, '').gsub(/Builder/, '').downcase
self.class.to_s.gsub('ReVIEW::', '').gsub('Builder', '').downcase
end

def load_words(file)
Expand Down Expand Up @@ -405,10 +405,10 @@ def inline_bou(str)
def inline_ruby(arg)
base, *ruby = *arg.scan(/(?:(?:(?:\\\\)*\\,)|[^,\\]+)+/)
if base
base = base.gsub(/\\,/, ',').strip
base = base.gsub('\,', ',').strip
end
if ruby
ruby = ruby.join(',').gsub(/\\,/, ',').strip
ruby = ruby.join(',').gsub('\,', ',').strip
end
compile_ruby(base, ruby)
end
Expand All @@ -420,9 +420,9 @@ def inline_kw(arg)

def inline_href(arg)
url, label = *arg.scan(/(?:(?:(?:\\\\)*\\,)|[^,\\]+)+/).map(&:lstrip)
url = url.gsub(/\\,/, ',').strip
url = url.gsub('\,', ',').strip
if label
label = label.gsub(/\\,/, ',').strip
label = label.gsub('\,', ',').strip
end
compile_href(url, label)
end
Expand Down Expand Up @@ -640,7 +640,7 @@ def graph(lines, id, command, caption = '')
tf.puts content
tf.close
begin
file_path = send("graph_#{command}".to_sym, id, file_path, content, tf.path)
file_path = send(:"graph_#{command}", id, file_path, content, tf.path)
ensure
tf.unlink
end
Expand Down
4 changes: 2 additions & 2 deletions lib/review/compiler.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2009-2022 Minero Aoki, Kenshi Muto
# Copyright (c) 2009-2024 Minero Aoki, Kenshi Muto
# Copyright (c) 2002-2007 Minero Aoki
#
# This program is free software.
Expand Down Expand Up @@ -681,7 +681,7 @@ def text(str, block_mode = false)
end
break if words.empty?

result << compile_inline(revert_replace_fence(words.shift.gsub(/\\\}/, '}').gsub(/\\\\/, '\\')))
result << compile_inline(revert_replace_fence(words.shift.gsub('\\}', '}').gsub('\\\\', '\\')))
end
result
rescue StandardError => e
Expand Down
2 changes: 1 addition & 1 deletion lib/review/htmltoc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def decode_args(args_str)
end

def encode_args(args)
args.delete_if { |_k, v| v.nil? }.map { |k, v| "#{k}=#{v}" }.join(',')
args.compact.map { |k, v| "#{k}=#{v}" }.join(',')
end
end
end
6 changes: 3 additions & 3 deletions lib/review/idgxmlbuilder.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2008-2023 Minero Aoki, Kenshi Muto
# Copyright (c) 2008-2024 Minero Aoki, Kenshi Muto
# 2002-2007 Minero Aoki
#
# This program is free software.
Expand Down Expand Up @@ -532,9 +532,9 @@ def parse_table_rows(lines)
next
end
if @tablewidth
rows.push(line.gsub(/\t\.\t/, "\tDUMMYCELLSPLITTER\t").gsub(/\t\.\.\t/, "\t.\t").gsub(/\t\.\Z/, "\tDUMMYCELLSPLITTER").gsub(/\t\.\.\Z/, "\t.").gsub(/\A\./, ''))
rows.push(line.gsub("\t.\t", "\tDUMMYCELLSPLITTER\t").gsub("\t..\t", "\t.\t").gsub(/\t\.\Z/, "\tDUMMYCELLSPLITTER").gsub(/\t\.\.\Z/, "\t.").gsub(/\A\./, ''))
else
rows.push(line.gsub(/\t\.\t/, "\t\t").gsub(/\t\.\.\t/, "\t.\t").gsub(/\t\.\Z/, "\t").gsub(/\t\.\.\Z/, "\t.").gsub(/\A\./, ''))
rows.push(line.gsub("\t.\t", "\t\t").gsub("\t..\t", "\t.\t").gsub(/\t\.\Z/, "\t").gsub(/\t\.\.\Z/, "\t.").gsub(/\A\./, ''))
end
col2 = rows[rows.length - 1].split(table_row_separator_regexp).length
@col = col2 if col2 > @col
Expand Down
2 changes: 1 addition & 1 deletion lib/review/logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def debug(msg, location: nil)
end

def ttylogger?
nil
false
end

def success(_log)
Expand Down
8 changes: 4 additions & 4 deletions lib/review/markdownbuilder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -190,19 +190,19 @@ def compile_href(url, label)
end

def inline_i(str)
"*#{str.gsub(/\*/, '\*')}*"
"*#{str.gsub('*', '\*')}*"
end

def inline_em(str)
"*#{str.gsub(/\*/, '\*')}*"
"*#{str.gsub('*', '\*')}*"
end

def inline_b(str)
"**#{str.gsub(/\*/, '\*')}**"
"**#{str.gsub('*', '\*')}**"
end

def inline_strong(str)
"**#{str.gsub(/\*/, '\*')}**"
"**#{str.gsub('*', '\*')}**"
end

def inline_code(str)
Expand Down
4 changes: 2 additions & 2 deletions lib/review/textutils.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2008-2020 Minero Aoki, Kenshi Muto, Masayoshi Takahashi,
# Copyright (c) 2008-2023 Minero Aoki, Kenshi Muto, Masayoshi Takahashi,
# KADO Masanori
# 2002-2007 Minero Aoki
#
Expand Down Expand Up @@ -49,7 +49,7 @@ def add_space?(line1, line2, lang, lazy = nil)
tail = line1[-1]
head = line2[0]
if tail.nil? || head.nil?
return nil
return false
end

space = true
Expand Down
2 changes: 2 additions & 0 deletions lib/review/yamlloader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ def self.safe_load_file(file)
YAML.safe_load(f, [Date])
rescue Psych::DisallowedClass
# < Ruby 2.5
# rubocop:disable Style/YAMLFileRead
YAML.safe_load(File.read(file), [Date])
# rubocop:enable Style/YAMLFileRead
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion review.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Gem::Specification.new do |gem|
gem.add_development_dependency('playwright-runner')
gem.add_development_dependency('pygments.rb')
gem.add_development_dependency('rake')
gem.add_development_dependency('rubocop', '~> 1.45.1')
gem.add_development_dependency('rubocop', '~> 1.59.0')
gem.add_development_dependency('rubocop-performance')
gem.add_development_dependency('rubocop-rake')
gem.add_development_dependency('simplecov')
Expand Down
Loading