Skip to content

Commit

Permalink
rubocop: fix assignment in condition
Browse files Browse the repository at this point in the history
  • Loading branch information
grosser committed Mar 24, 2024
1 parent 252e71b commit a85600d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
9 changes: 0 additions & 9 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ AllCops:
Style/StringLiterals:
Enabled: false

Style/StringLiteralsInInterpolation:
Enabled: false

Lint/AmbiguousRegexpLiteral:
Enabled: false

Bundler/OrderedGems:
Enabled: false

Expand Down Expand Up @@ -65,9 +59,6 @@ Style/SymbolArray:
Style/GuardClause:
Enabled: false

Lint/AssignmentInCondition:
Enabled: false

Style/EmptyElse:
Enabled: false

Expand Down
12 changes: 6 additions & 6 deletions lib/parallel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ def worker_number=(worker_num)
private

def add_progress_bar!(job_factory, options)
if progress_options = options[:progress]
if (progress_options = options[:progress])
raise "Progressbar can only be used with array like items" if job_factory.size == Float::INFINITY
require 'ruby-progressbar'

Expand Down Expand Up @@ -388,7 +388,7 @@ def work_direct(job_factory, options, &block)
results = []
exception = nil
begin
while set = job_factory.next
while (set = job_factory.next)
item, index = set
results << with_instrumentation(item, index, options) do
call_with_index(item, index, options, &block)
Expand All @@ -411,7 +411,7 @@ def work_in_threads(job_factory, options, &block)
in_threads(options) do |worker_num|
self.worker_number = worker_num
# as long as there are more jobs, work on one of them
while !exception && set = job_factory.next
while !exception && (set = job_factory.next)
begin
item, index = set
result = with_instrumentation item, index, options do
Expand Down Expand Up @@ -455,7 +455,7 @@ def work_in_ractors(job_factory, options)

# start
ractors.dup.each do |ractor|
if set = job_factory.next
if (set = job_factory.next)
item, index = set
instrument_start item, index, options
ractor.send [callback, item, index]
Expand All @@ -466,7 +466,7 @@ def work_in_ractors(job_factory, options)
end

# replace with new items
while set = job_factory.next
while (set = job_factory.next)
item_next, index_next = set
done, (exception, result, item, index) = Ractor.select(*ractors)
if exception
Expand Down Expand Up @@ -669,7 +669,7 @@ def instrument_finish_in_order(item, index, result, options)
end

def instrument_start(item, index, options)
return unless on_start = options[:start]
return unless (on_start = options[:start])
options[:mutex].synchronize { on_start.call(item, index) }
end
end
Expand Down

0 comments on commit a85600d

Please sign in to comment.