RUBY-3912 Fix Lint/MissingSuper violations#3079
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes the Lint/MissingSuper exclusion from .rubocop_todo.yml and updates subclass initializers across the driver and spec runners to call super, bringing the codebase into RuboCop compliance without rubocop:disable workarounds.
Changes:
- Removed the
Lint/MissingSuperdisable block from.rubocop_todo.yml. - Added
super()calls to initializers of various monitoring/event, server-connection, and spec-runner classes whose ancestors do not define meaningfulinitialize. - Simplified
Operation::Insert::BulkResult#initializeto delegate reply/connection handling toOperation::Resultviasuper(...).
Reviewed changes
Copilot reviewed 32 out of 32 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| spec/runners/transactions/test.rb | Calls super() in test initializer to satisfy Lint/MissingSuper. |
| spec/runners/crud/test.rb | Calls super() in test initializer to satisfy Lint/MissingSuper. |
| spec/runners/change_streams/test.rb | Calls super() in test initializer to satisfy Lint/MissingSuper. |
| lib/mongo/server/pending_connection.rb | Calls super() in initializer (ancestor has no custom initializer). |
| lib/mongo/server/monitor/connection.rb | Calls super() in initializer (ancestor has no custom initializer). |
| lib/mongo/server/connection.rb | Calls super() in initializer (ancestor has no custom initializer). |
| lib/mongo/protocol/compressed.rb | Calls super() to run Message request-id setup, then overrides @request_id to match wrapped message. |
| lib/mongo/operation/insert/bulk_result.rb | Delegates reply/connection setup to Operation::Result#initialize via super(...). |
| lib/mongo/monitoring/event/topology_opening.rb | Calls super() in event initializer. |
| lib/mongo/monitoring/event/topology_closed.rb | Calls super() in event initializer. |
| lib/mongo/monitoring/event/topology_changed.rb | Calls super() in event initializer. |
| lib/mongo/monitoring/event/server_opening.rb | Calls super() in event initializer. |
| lib/mongo/monitoring/event/server_heartbeat_succeeded.rb | Calls super() in event initializer. |
| lib/mongo/monitoring/event/server_heartbeat_started.rb | Calls super() in event initializer. |
| lib/mongo/monitoring/event/server_heartbeat_failed.rb | Calls super() in event initializer. |
| lib/mongo/monitoring/event/server_description_changed.rb | Calls super() in event initializer. |
| lib/mongo/monitoring/event/server_closed.rb | Calls super() in event initializer. |
| lib/mongo/monitoring/event/command_succeeded.rb | Calls super() in event initializer. |
| lib/mongo/monitoring/event/command_started.rb | Calls super() in event initializer. |
| lib/mongo/monitoring/event/command_failed.rb | Calls super() in event initializer. |
| lib/mongo/monitoring/event/cmap/pool_ready.rb | Calls super() in event initializer. |
| lib/mongo/monitoring/event/cmap/pool_created.rb | Calls super() in event initializer. |
| lib/mongo/monitoring/event/cmap/pool_closed.rb | Calls super() in event initializer. |
| lib/mongo/monitoring/event/cmap/pool_cleared.rb | Calls super() in event initializer. |
| lib/mongo/monitoring/event/cmap/connection_ready.rb | Calls super() in event initializer. |
| lib/mongo/monitoring/event/cmap/connection_created.rb | Calls super() in event initializer. |
| lib/mongo/monitoring/event/cmap/connection_closed.rb | Calls super() in event initializer. |
| lib/mongo/monitoring/event/cmap/connection_checked_out.rb | Calls super() in event initializer. |
| lib/mongo/monitoring/event/cmap/connection_checked_in.rb | Calls super() in event initializer. |
| lib/mongo/monitoring/event/cmap/connection_check_out_started.rb | Calls super() in event initializer. |
| lib/mongo/monitoring/event/cmap/connection_check_out_failed.rb | Calls super() in event initializer. |
| .rubocop_todo.yml | Removes Lint/MissingSuper: Enabled: false block now that code is compliant. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
comandeo-mongo
approved these changes
Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Removes the
Lint/MissingSuperexclusion from.rubocop_todo.ymland brings the code into compliance. Every subclassinitializenow callssuper.Most cases were mechanical: the class descends from a parent with no meaningful
initialize(Mongo::Event::Base,ConnectionCommon,CRUDTestBase— all effectivelyObject), sosuper()was added at the top of the initializer.Two cases warranted more thought and turned out not to need
rubocop:disable:Operation::Insert::BulkResult— its custominitializeduplicated the parent's reply/connection assignment. Tracing every construction site showsBulkResultis only built from aResultsubclass'sbulk_resultmethod, which passes an already-validated single-element@repliesarray. The "must support multi-reply arrays" premise was vestigial, so it now simply delegates tosuper.Protocol::Compressed— the parentMessage#initializeassigns a fresh request id, but a compressed message must reuse the wrapped message's id. It now callssuper()and overrides@request_idafterward (last write wins).Testing
rubocop --only Lint/MissingSuper: clean across 1048 files, norubocop:disablecomments.