Skip to content
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
5 changes: 0 additions & 5 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ Lint/IncompatibleIoSelectWithFiberScheduler:
- 'lib/mongo/socket/ssl.rb'
- 'lib/mongo/socket/tcp.rb'

# Offense count: 2
Lint/NextWithoutAccumulator:
Exclude:
- 'lib/mongo/operation/shared/result/aggregatable.rb'

# Offense count: 12
Lint/RescueException:
Exclude:
Expand Down
6 changes: 3 additions & 3 deletions lib/mongo/operation/shared/result/aggregatable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def aggregate_write_errors(count)
return unless @replies

@replies.reduce(nil) do |errors, reply|
next unless (write_errors = reply.documents.first['writeErrors'])
next errors unless (write_errors = reply.documents.first['writeErrors'])

wes = write_errors.collect do |we|
we.merge!('index' => count + we['index'])
Expand All @@ -59,11 +59,11 @@ def aggregate_write_concern_errors(count)
return unless @replies

@replies.each_with_index.reduce(nil) do |errors, (reply, _)|
next unless (write_concern_errors = reply.documents.first['writeConcernErrors'])
next errors unless (write_concern_errors = reply.documents.first['writeConcernErrors'])

(errors || []) << write_concern_errors.reduce(nil) do |errs, wce|
wce.merge!('index' => count + wce['index'])
(errs || []) << write_concern_error
(errs || []) << wce
end
end
end
Expand Down
Loading