Skip to content

Commit

Permalink
update rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
grosser committed Mar 24, 2024
1 parent 3a6989b commit 252e71b
Show file tree
Hide file tree
Showing 14 changed files with 35 additions and 27 deletions.
32 changes: 20 additions & 12 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,20 @@ GEM
diff-lcs (1.5.0)
i18n (1.10.0)
concurrent-ruby (~> 1.0)
json (2.7.1)
json (2.7.1-java)
language_server-protocol (3.17.0.3)
minitest (5.15.0)
mysql2 (0.5.6)
parser (3.1.1.0)
parser (3.3.0.5)
ast (~> 2.4.1)
racc
racc (1.7.3)
racc (1.7.3-java)
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.2.1)
rexml (3.2.5)
regexp_parser (2.9.0)
rexml (3.2.6)
rspec (3.11.0)
rspec-core (~> 3.11.0)
rspec-expectations (~> 3.11.0)
Expand All @@ -48,26 +54,28 @@ GEM
rspec-rerun (1.1.0)
rspec (~> 3.0)
rspec-support (3.11.0)
rubocop (1.26.0)
rubocop (1.62.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.1.0.0)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.16.0, < 2.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.16.0)
parser (>= 3.1.1.0)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.2)
parser (>= 3.3.0.4)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-rspec (2.9.0)
rubocop (~> 1.19)
ruby-progressbar (1.11.0)
ruby-progressbar (1.13.0)
sqlite3 (1.4.2)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
unicode-display_width (2.1.0)
unicode-display_width (2.5.0)
zeitwerk (2.5.4)

PLATFORMS
Expand Down
2 changes: 1 addition & 1 deletion lib/parallel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class UndumpableException < StandardError
attr_reader :backtrace

def initialize(original)
super "#{original.class}: #{original.message}"
super("#{original.class}: #{original.message}")
@backtrace = original.backtrace
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/cases/each_with_ar_sqlite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require "sqlite3"
require "tempfile"
$stdout.sync = true
in_worker_type = "in_#{ENV.fetch('WORKER_TYPE')}".to_sym
in_worker_type = :"in_#{ENV.fetch('WORKER_TYPE')}"

Tempfile.create("db") do |temp|
ActiveRecord::Schema.verbose = false
Expand Down
2 changes: 1 addition & 1 deletion spec/cases/finish_in_order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def self.call(item)
end

method = ENV.fetch('METHOD')
in_worker_type = "in_#{ENV.fetch('WORKER_TYPE')}".to_sym
in_worker_type = :"in_#{ENV.fetch('WORKER_TYPE')}"
$stdout.sync = true

items = [nil, false, 2, 3, 4]
Expand Down
2 changes: 1 addition & 1 deletion spec/cases/profile_memory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def self.call(x); end
require './spec/cases/helper'

items = Array.new(1000)
options = { "in_#{ARGV[0]}".to_sym => 2 }
options = { "in_#{ARGV[0]}": 2 }

# TODO: not sure why this fails without 2.times in threading mode :(

Expand Down
2 changes: 1 addition & 1 deletion spec/cases/with_break.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$stdout.sync = true # otherwise results can go weird...

method = ENV.fetch('METHOD')
in_worker_type = "in_#{ENV.fetch('WORKER_TYPE')}".to_sym
in_worker_type = :"in_#{ENV.fetch('WORKER_TYPE')}"
worker_size = (ENV['WORKER_SIZE'] || 4).to_i

ARGV.freeze # make ractor happy
Expand Down
2 changes: 1 addition & 1 deletion spec/cases/with_break_before_finish.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require './spec/cases/helper'

method = ENV.fetch('METHOD')
in_worker_type = "in_#{ENV.fetch('WORKER_TYPE')}".to_sym
in_worker_type = :"in_#{ENV.fetch('WORKER_TYPE')}"
$stdout.sync = true

class Callback
Expand Down
2 changes: 1 addition & 1 deletion spec/cases/with_exception.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$stdout.sync = true # otherwise results can go weird...

method = ENV.fetch('METHOD')
in_worker_type = "in_#{ENV.fetch('WORKER_TYPE')}".to_sym
in_worker_type = :"in_#{ENV.fetch('WORKER_TYPE')}"
worker_size = (ENV['WORKER_SIZE'] || 4).to_i

class ParallelTestError < StandardError
Expand Down
2 changes: 1 addition & 1 deletion spec/cases/with_exception_before_finish.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require './spec/cases/helper'

method = ENV.fetch('METHOD')
in_worker_type = "in_#{ENV.fetch('WORKER_TYPE')}".to_sym
in_worker_type = :"in_#{ENV.fetch('WORKER_TYPE')}"

class ParallelTestError < StandardError
end
Expand Down
2 changes: 1 addition & 1 deletion spec/cases/with_exception_in_finish.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

$stdout.sync = true
method = ENV.fetch('METHOD')
in_worker_type = "in_#{ENV.fetch('WORKER_TYPE')}".to_sym
in_worker_type = :"in_#{ENV.fetch('WORKER_TYPE')}"

class ParallelTestError < StandardError
end
Expand Down
2 changes: 1 addition & 1 deletion spec/cases/with_exception_in_start.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require './spec/cases/helper'

method = ENV.fetch('METHOD')
in_worker_type = "in_#{ENV.fetch('WORKER_TYPE')}".to_sym
in_worker_type = :"in_#{ENV.fetch('WORKER_TYPE')}"

class ParallelTestError < StandardError
end
Expand Down
2 changes: 1 addition & 1 deletion spec/cases/with_exception_in_start_before_finish.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require './spec/cases/helper'

method = ENV.fetch('METHOD')
in_worker_type = "in_#{ENV.fetch('WORKER_TYPE')}".to_sym
in_worker_type = :"in_#{ENV.fetch('WORKER_TYPE')}"
$stdout.sync = true

class ParallelTestError < StandardError
Expand Down
2 changes: 1 addition & 1 deletion spec/cases/with_worker_number.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require './spec/cases/helper'

method = ENV.fetch('METHOD')
in_worker_type = "in_#{ENV.fetch('WORKER_TYPE')}".to_sym
in_worker_type = :"in_#{ENV.fetch('WORKER_TYPE')}"

Parallel.public_send(method, 1..100, in_worker_type => 4) do
sleep 0.1 # so all workers get started
Expand Down
6 changes: 3 additions & 3 deletions spec/parallel_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def cpus
kill_process_with_name("spec/cases/parallel_fast_exit.rb") # simulates Ctrl+c
sleep 1
result = t.value
result.scan(/I finished/).size.should == 3
result.scan("I finished").size.should == 3
result.should_not include("Parallel execution interrupted")
end.should <= 4
end
Expand Down Expand Up @@ -334,7 +334,7 @@ def cpus

it "sets Parallel.worker_number with 0 #{type}" do
skip if type == "ractors" # not supported
type_key = "in_#{type}".to_sym
type_key = :"in_#{type}"
result = Parallel.map([1, 2, 3, 4, 5, 6, 7, 8, 9], type_key => 0) { |_x| Parallel.worker_number }
result.uniq.should == [0]
Parallel.worker_number.should be_nil
Expand All @@ -343,7 +343,7 @@ def cpus
it "can run with 0 by not using #{type}" do
Thread.should_not_receive(:exclusive)
Process.should_not_receive(:fork)
result = Parallel.map([1, 2, 3, 4, 5, 6, 7, 8, 9], "in_#{type}".to_sym => 0) { |x| x + 2 }
result = Parallel.map([1, 2, 3, 4, 5, 6, 7, 8, 9], "in_#{type}": 0) { |x| x + 2 }
result.should == [3, 4, 5, 6, 7, 8, 9, 10, 11]
end

Expand Down

0 comments on commit 252e71b

Please sign in to comment.