Skip to content

RUBY-3912 Fix Lint/MissingSuper violations#3079

Merged
jamis merged 2 commits into
mongodb:masterfrom
jamis:3912-lint-missingsuper
Jul 9, 2026
Merged

RUBY-3912 Fix Lint/MissingSuper violations#3079
jamis merged 2 commits into
mongodb:masterfrom
jamis:3912-lint-missingsuper

Conversation

@jamis

@jamis jamis commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Description

Removes the Lint/MissingSuper exclusion from .rubocop_todo.yml and brings the code into compliance. Every subclass initialize now calls super.

Most cases were mechanical: the class descends from a parent with no meaningful initialize (Mongo::Event::Base, ConnectionCommon, CRUDTestBase — all effectively Object), so super() 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 custom initialize duplicated the parent's reply/connection assignment. Tracing every construction site shows BulkResult is only built from a Result subclass's bulk_result method, which passes an already-validated single-element @replies array. The "must support multi-reply arrays" premise was vestigial, so it now simply delegates to super.
  • Protocol::Compressed — the parent Message#initialize assigns a fresh request id, but a compressed message must reuse the wrapped message's id. It now calls super() and overrides @request_id afterward (last write wins).

Testing

  • rubocop --only Lint/MissingSuper: clean across 1048 files, no rubocop:disable comments.
  • Ran the affected specs against a local replica set: monitoring events, protocol/compressed, server connection/monitor, bulk write, CRUD spec-runner suite, and zlib compression — all green.

@jamis jamis requested a review from a team as a code owner July 8, 2026 21:30
@jamis jamis requested review from comandeo-mongo and Copilot July 8, 2026 21:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/MissingSuper disable 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 meaningful initialize.
  • Simplified Operation::Insert::BulkResult#initialize to delegate reply/connection handling to Operation::Result via super(...).

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.

@jamis jamis marked this pull request as draft July 8, 2026 21:40
@jamis jamis marked this pull request as ready for review July 8, 2026 23:06
@jamis jamis merged commit 1a57dff into mongodb:master Jul 9, 2026
213 checks passed
@jamis jamis deleted the 3912-lint-missingsuper branch July 9, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants