diff --git a/.mod/drivers-evergreen-tools b/.mod/drivers-evergreen-tools index 9c21ebe36b..d8aa120a15 160000 --- a/.mod/drivers-evergreen-tools +++ b/.mod/drivers-evergreen-tools @@ -1 +1 @@ -Subproject commit 9c21ebe36bf099988360cb83288e4820aa3bf27c +Subproject commit d8aa120a1590a68bfb337b98da1d240914a843c2 diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 727371208f..efc96c3d5c 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -13,11 +13,6 @@ Lint/IncompatibleIoSelectWithFiberScheduler: - 'lib/mongo/socket/ssl.rb' - 'lib/mongo/socket/tcp.rb' -# Offense count: 31 -# Configuration parameters: AllowedParentClasses. -Lint/MissingSuper: - Enabled: false - # Offense count: 1 Lint/MixedRegexpCaptureTypes: Exclude: diff --git a/lib/mongo/monitoring/event/cmap/connection_check_out_failed.rb b/lib/mongo/monitoring/event/cmap/connection_check_out_failed.rb index 03cb9ca178..686149d3bf 100644 --- a/lib/mongo/monitoring/event/cmap/connection_check_out_failed.rb +++ b/lib/mongo/monitoring/event/cmap/connection_check_out_failed.rb @@ -62,6 +62,7 @@ class ConnectionCheckOutFailed < Base # @since 2.9.0 # @api private def initialize(address, reason) + super() @reason = reason @address = address end diff --git a/lib/mongo/monitoring/event/cmap/connection_check_out_started.rb b/lib/mongo/monitoring/event/cmap/connection_check_out_started.rb index 3dc187043d..e087ea5ee0 100644 --- a/lib/mongo/monitoring/event/cmap/connection_check_out_started.rb +++ b/lib/mongo/monitoring/event/cmap/connection_check_out_started.rb @@ -35,6 +35,7 @@ class ConnectionCheckOutStarted < Base # @since 2.9.0 # @api private def initialize(address) + super() @address = address end diff --git a/lib/mongo/monitoring/event/cmap/connection_checked_in.rb b/lib/mongo/monitoring/event/cmap/connection_checked_in.rb index 8eef448b0b..7d1457ace0 100644 --- a/lib/mongo/monitoring/event/cmap/connection_checked_in.rb +++ b/lib/mongo/monitoring/event/cmap/connection_checked_in.rb @@ -47,6 +47,7 @@ class ConnectionCheckedIn < Base # @since 2.9.0 # @api private def initialize(address, id, pool) + super() @address = address @connection_id = id @pool = pool diff --git a/lib/mongo/monitoring/event/cmap/connection_checked_out.rb b/lib/mongo/monitoring/event/cmap/connection_checked_out.rb index c645908927..3fceb15724 100644 --- a/lib/mongo/monitoring/event/cmap/connection_checked_out.rb +++ b/lib/mongo/monitoring/event/cmap/connection_checked_out.rb @@ -48,6 +48,7 @@ class ConnectionCheckedOut < Base # @since 2.9.0 # @api private def initialize(address, id, pool) + super() @address = address @connection_id = id @pool = pool diff --git a/lib/mongo/monitoring/event/cmap/connection_closed.rb b/lib/mongo/monitoring/event/cmap/connection_closed.rb index 2ebcec9dae..8baa4befbd 100644 --- a/lib/mongo/monitoring/event/cmap/connection_closed.rb +++ b/lib/mongo/monitoring/event/cmap/connection_closed.rb @@ -79,6 +79,7 @@ class ConnectionClosed < Base # @since 2.9.0 # @api private def initialize(address, id, reason) + super() @reason = reason @address = address @connection_id = id diff --git a/lib/mongo/monitoring/event/cmap/connection_created.rb b/lib/mongo/monitoring/event/cmap/connection_created.rb index 9cbf42c73e..1aed1ade7c 100644 --- a/lib/mongo/monitoring/event/cmap/connection_created.rb +++ b/lib/mongo/monitoring/event/cmap/connection_created.rb @@ -41,6 +41,7 @@ class ConnectionCreated < Base # @since 2.9.0 # @api private def initialize(address, id) + super() @address = address @connection_id = id end diff --git a/lib/mongo/monitoring/event/cmap/connection_ready.rb b/lib/mongo/monitoring/event/cmap/connection_ready.rb index 5a8426aa05..9b737648bc 100644 --- a/lib/mongo/monitoring/event/cmap/connection_ready.rb +++ b/lib/mongo/monitoring/event/cmap/connection_ready.rb @@ -41,6 +41,7 @@ class ConnectionReady < Base # @since 2.9.0 # @api private def initialize(address, id) + super() @address = address @connection_id = id end diff --git a/lib/mongo/monitoring/event/cmap/pool_cleared.rb b/lib/mongo/monitoring/event/cmap/pool_cleared.rb index 77c4e94586..31d5e757cb 100644 --- a/lib/mongo/monitoring/event/cmap/pool_cleared.rb +++ b/lib/mongo/monitoring/event/cmap/pool_cleared.rb @@ -43,6 +43,7 @@ class PoolCleared < Base # # @api private def initialize(address, service_id: nil, interrupt_in_use_connections: nil) + super() @address = address @service_id = service_id @options = {} diff --git a/lib/mongo/monitoring/event/cmap/pool_closed.rb b/lib/mongo/monitoring/event/cmap/pool_closed.rb index 0f859535b2..ce959f6b99 100644 --- a/lib/mongo/monitoring/event/cmap/pool_closed.rb +++ b/lib/mongo/monitoring/event/cmap/pool_closed.rb @@ -42,6 +42,7 @@ class PoolClosed < Base # @since 2.9.0 # @api private def initialize(address, pool) + super() @address = address @pool = pool end diff --git a/lib/mongo/monitoring/event/cmap/pool_created.rb b/lib/mongo/monitoring/event/cmap/pool_created.rb index 6df3b6fc68..4631d4e7ed 100644 --- a/lib/mongo/monitoring/event/cmap/pool_created.rb +++ b/lib/mongo/monitoring/event/cmap/pool_created.rb @@ -48,6 +48,7 @@ class PoolCreated < Base # @since 2.9.0 # @api private def initialize(address, options, pool) + super() @address = address @options = options.dup.freeze @pool = pool diff --git a/lib/mongo/monitoring/event/cmap/pool_ready.rb b/lib/mongo/monitoring/event/cmap/pool_ready.rb index aa66642320..63a94530d2 100644 --- a/lib/mongo/monitoring/event/cmap/pool_ready.rb +++ b/lib/mongo/monitoring/event/cmap/pool_ready.rb @@ -41,6 +41,7 @@ class PoolReady < Base # @since 2.9.0 # @api private def initialize(address, options, pool) + super() @address = address @options = options.dup.freeze @pool = pool diff --git a/lib/mongo/monitoring/event/command_failed.rb b/lib/mongo/monitoring/event/command_failed.rb index c9a0bcbcc8..38d5ed103b 100644 --- a/lib/mongo/monitoring/event/command_failed.rb +++ b/lib/mongo/monitoring/event/command_failed.rb @@ -83,6 +83,7 @@ class CommandFailed < Mongo::Event::Base def initialize(command_name, database_name, address, request_id, operation_id, message, failure, duration, started_event:, server_connection_id: nil, service_id: nil) + super() @command_name = command_name.to_s @database_name = database_name @address = address diff --git a/lib/mongo/monitoring/event/command_started.rb b/lib/mongo/monitoring/event/command_started.rb index 524158137b..b4748cb8d8 100644 --- a/lib/mongo/monitoring/event/command_started.rb +++ b/lib/mongo/monitoring/event/command_started.rb @@ -84,6 +84,7 @@ def initialize(command_name, database_name, address, request_id, operation_id, command, socket_object_id: nil, connection_id: nil, connection_generation: nil, server_connection_id: nil, service_id: nil) + super() @command_name = command_name.to_s @database_name = database_name @address = address diff --git a/lib/mongo/monitoring/event/command_succeeded.rb b/lib/mongo/monitoring/event/command_succeeded.rb index 5109608d7d..85d0c707e6 100644 --- a/lib/mongo/monitoring/event/command_succeeded.rb +++ b/lib/mongo/monitoring/event/command_succeeded.rb @@ -76,6 +76,7 @@ class CommandSucceeded < Mongo::Event::Base def initialize(command_name, database_name, address, request_id, operation_id, reply, duration, started_event:, server_connection_id: nil, service_id: nil) + super() @command_name = command_name.to_s @database_name = database_name @address = address diff --git a/lib/mongo/monitoring/event/server_closed.rb b/lib/mongo/monitoring/event/server_closed.rb index a481c054c9..cc6dd4aac5 100644 --- a/lib/mongo/monitoring/event/server_closed.rb +++ b/lib/mongo/monitoring/event/server_closed.rb @@ -37,6 +37,7 @@ class ServerClosed < Mongo::Event::Base # # @since 2.4.0 def initialize(address, topology) + super() @address = address @topology = topology end diff --git a/lib/mongo/monitoring/event/server_description_changed.rb b/lib/mongo/monitoring/event/server_description_changed.rb index 91fa5626a7..3ce82efc0a 100644 --- a/lib/mongo/monitoring/event/server_description_changed.rb +++ b/lib/mongo/monitoring/event/server_description_changed.rb @@ -58,6 +58,7 @@ def awaited? # @api private def initialize(address, topology, previous_description, new_description, awaited: false) + super() @address = address @topology = topology @previous_description = previous_description diff --git a/lib/mongo/monitoring/event/server_heartbeat_failed.rb b/lib/mongo/monitoring/event/server_heartbeat_failed.rb index addca31582..dd258eea97 100644 --- a/lib/mongo/monitoring/event/server_heartbeat_failed.rb +++ b/lib/mongo/monitoring/event/server_heartbeat_failed.rb @@ -35,6 +35,7 @@ class ServerHeartbeatFailed < Mongo::Event::Base # @since 2.7.0 # @api private def initialize(address, round_trip_time, error, started_event:, awaited: false) + super() @address = address @round_trip_time = round_trip_time @error = error diff --git a/lib/mongo/monitoring/event/server_heartbeat_started.rb b/lib/mongo/monitoring/event/server_heartbeat_started.rb index 48a7af4d2f..a7979dc25e 100644 --- a/lib/mongo/monitoring/event/server_heartbeat_started.rb +++ b/lib/mongo/monitoring/event/server_heartbeat_started.rb @@ -40,6 +40,7 @@ def awaited? # @since 2.7.0 # @api private def initialize(address, awaited: false) + super() @address = address @awaited = !!awaited end diff --git a/lib/mongo/monitoring/event/server_heartbeat_succeeded.rb b/lib/mongo/monitoring/event/server_heartbeat_succeeded.rb index 773e9b6e2f..803d1ddafb 100644 --- a/lib/mongo/monitoring/event/server_heartbeat_succeeded.rb +++ b/lib/mongo/monitoring/event/server_heartbeat_succeeded.rb @@ -35,6 +35,7 @@ class ServerHeartbeatSucceeded < Mongo::Event::Base # @since 2.7.0 # @api private def initialize(address, round_trip_time, started_event:, awaited: false) + super() @address = address @round_trip_time = round_trip_time @awaited = !!awaited diff --git a/lib/mongo/monitoring/event/server_opening.rb b/lib/mongo/monitoring/event/server_opening.rb index 902f1595e7..24e544fa1b 100644 --- a/lib/mongo/monitoring/event/server_opening.rb +++ b/lib/mongo/monitoring/event/server_opening.rb @@ -37,6 +37,7 @@ class ServerOpening < Mongo::Event::Base # # @since 2.4.0 def initialize(address, topology) + super() @address = address @topology = topology end diff --git a/lib/mongo/monitoring/event/topology_changed.rb b/lib/mongo/monitoring/event/topology_changed.rb index 9a7908e266..3c14e6e5ad 100644 --- a/lib/mongo/monitoring/event/topology_changed.rb +++ b/lib/mongo/monitoring/event/topology_changed.rb @@ -37,6 +37,7 @@ class TopologyChanged < Mongo::Event::Base # # @since 2.4.0 def initialize(previous_topology, new_topology) + super() @previous_topology = previous_topology @new_topology = new_topology end diff --git a/lib/mongo/monitoring/event/topology_closed.rb b/lib/mongo/monitoring/event/topology_closed.rb index d9099f00d6..d118369528 100644 --- a/lib/mongo/monitoring/event/topology_closed.rb +++ b/lib/mongo/monitoring/event/topology_closed.rb @@ -33,6 +33,7 @@ class TopologyClosed < Mongo::Event::Base # # @since 2.4.0 def initialize(topology) + super() @topology = topology end diff --git a/lib/mongo/monitoring/event/topology_opening.rb b/lib/mongo/monitoring/event/topology_opening.rb index 2ddd24a87f..ad28af3faf 100644 --- a/lib/mongo/monitoring/event/topology_opening.rb +++ b/lib/mongo/monitoring/event/topology_opening.rb @@ -33,6 +33,7 @@ class TopologyOpening < Mongo::Event::Base # # @since 2.4.0 def initialize(topology) + super() @topology = topology end diff --git a/lib/mongo/operation/insert/bulk_result.rb b/lib/mongo/operation/insert/bulk_result.rb index 9b9f4b11e5..dbda51631a 100644 --- a/lib/mongo/operation/insert/bulk_result.rb +++ b/lib/mongo/operation/insert/bulk_result.rb @@ -47,9 +47,7 @@ class BulkResult < Operation::Result # @since 2.0.0 # @api private def initialize(replies, connection_description, connection_global_id, ids) - @replies = [ *replies ] if replies - @connection_description = connection_description - @connection_global_id = connection_global_id + super(replies, connection_description, connection_global_id) if replies && replies.first && (doc = replies.first.documents.first) if (errors = doc['writeErrors']) # some documents were potentially inserted diff --git a/lib/mongo/protocol/compressed.rb b/lib/mongo/protocol/compressed.rb index 7e586116a1..0e443ee024 100644 --- a/lib/mongo/protocol/compressed.rb +++ b/lib/mongo/protocol/compressed.rb @@ -74,12 +74,15 @@ class Compressed < Message # # @since 2.5.0 def initialize(message, compressor, zlib_compression_level = nil) + super() @original_message = message @original_op_code = message.op_code @uncompressed_size = 0 @compressor_id = COMPRESSOR_ID_MAP[compressor] @compressed_message = '' @zlib_compression_level = zlib_compression_level if zlib_compression_level && zlib_compression_level != -1 + # A compressed message must reuse the wrapped message's request id, + # overriding the fresh id assigned by the superclass initializer. @request_id = message.request_id end diff --git a/lib/mongo/server/connection.rb b/lib/mongo/server/connection.rb index 3f5390932d..e1acc5b43e 100644 --- a/lib/mongo/server/connection.rb +++ b/lib/mongo/server/connection.rb @@ -88,6 +88,7 @@ class Connection < ConnectionBase # # @since 2.0.0 def initialize(server, options = {}) + super() if server.load_balancer? && options[:generation] raise ArgumentError, 'Generation cannot be set when server is a load balancer' end diff --git a/lib/mongo/server/monitor/connection.rb b/lib/mongo/server/monitor/connection.rb index 110282df0b..e4c5d293e0 100644 --- a/lib/mongo/server/monitor/connection.rb +++ b/lib/mongo/server/monitor/connection.rb @@ -54,6 +54,7 @@ class Connection < Server::ConnectionCommon # # @since 2.0.0 def initialize(address, options = {}) + super() @address = address @options = options.dup.freeze raise ArgumentError, 'App metadata is required' unless (@app_metadata = options[:app_metadata]) diff --git a/lib/mongo/server/pending_connection.rb b/lib/mongo/server/pending_connection.rb index 3a7bebd768..99d4f42fae 100644 --- a/lib/mongo/server/pending_connection.rb +++ b/lib/mongo/server/pending_connection.rb @@ -23,6 +23,7 @@ class PendingConnection < ConnectionBase extend Forwardable def initialize(socket, server, monitoring, options = {}) + super() @socket = socket @options = options @server = server diff --git a/spec/runners/change_streams/test.rb b/spec/runners/change_streams/test.rb index 2df3d70d8f..314dabe540 100644 --- a/spec/runners/change_streams/test.rb +++ b/spec/runners/change_streams/test.rb @@ -22,6 +22,7 @@ module Mongo module ChangeStreams class ChangeStreamsTest < Mongo::CRUD::CRUDTestBase def initialize(crud_spec, test, collection_name, collection2_name, database_name, database2_name) + super() @spec = crud_spec @description = test['description'] diff --git a/spec/runners/crud/test.rb b/spec/runners/crud/test.rb index 89d5d94af7..02aa124ed7 100644 --- a/spec/runners/crud/test.rb +++ b/spec/runners/crud/test.rb @@ -25,6 +25,7 @@ class CRUDTest < CRUDTestBase # # @since 2.0.0 def initialize(crud_spec, data, test) + super() @spec = crud_spec @data = data @description = test['description'] diff --git a/spec/runners/transactions/test.rb b/spec/runners/transactions/test.rb index 5c1d17d812..6a7e771aca 100644 --- a/spec/runners/transactions/test.rb +++ b/spec/runners/transactions/test.rb @@ -42,6 +42,7 @@ class TransactionsTest < CRUD::CRUDTestBase # # @since 2.6.0 def initialize(crud_spec, data, test, expectations_bson_types: true) + super() test = IceNine.deep_freeze(test) @spec = crud_spec @data = data || []