Skip to content

More Rubocop work#3014

Open
jamis wants to merge 11 commits intomongodb:masterfrom
jamis:20260409-rubocop
Open

More Rubocop work#3014
jamis wants to merge 11 commits intomongodb:masterfrom
jamis:20260409-rubocop

Conversation

@jamis
Copy link
Copy Markdown
Contributor

@jamis jamis commented Apr 10, 2026

This removes exceptions for several more cops.

Copilot AI review requested due to automatic review settings April 10, 2026 14:46
@jamis jamis requested a review from a team as a code owner April 10, 2026 14:47
@jamis jamis requested a review from comandeo-mongo April 10, 2026 14:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 continues the RuboCop cleanup by addressing additional offenses directly in the codebase, allowing more cops to be removed from .rubocop_todo.yml and reducing the project’s lint exceptions.

Changes:

  • Removes/rewrites empty blocks and empty conditional bodies in specs, and disambiguates ambiguous ranges.
  • Refactors a few constant definitions and access modifiers to satisfy linting rules without behavior changes.
  • Makes small, semantics-preserving structure tweaks in a handful of library methods (e.g., begin/rescue assignment style, private placement).

Reviewed changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
spec/support/spec_config.rb Removes redundant attr_reader for connect_options (method already exists).
spec/spec_tests/uri_options_spec.rb Removes an empty conditional block.
spec/spec_tests/sdam_spec.rb Replaces in-block constant/class definitions with top-level helper class; uses class_eval for aliasing.
spec/runners/unified.rb Adds parentheses to avoid ambiguous range parsing in slicing.
spec/runners/transactions.rb Marks unused block arg and removes empty conditional bodies.
spec/runners/cmap.rb Removes a redundant attr_reader declaration.
spec/runners/change_streams/test.rb Rewrites begin/rescue assignment to satisfy linting.
spec/runners/auth.rb Removes redundant attr_reader :tests (method already exists).
spec/mongo/uri/srv_protocol_spec.rb Removes an empty let block.
spec/mongo/socket_spec.rb Uses StandardError instead of Exception in test exception classes.
spec/mongo/server/round_trip_time_calculator_spec.rb Replaces empty blocks with explicit { nil }.
spec/mongo/server/description/features_spec.rb Adds parentheses around ambiguous ranges.
spec/mongo/server/description_spec.rb Removes a duplicate empty example.
spec/mongo/server/connection_spec.rb Moves test exception constant out of the example group and inherits from StandardError.
spec/mongo/operation/result_spec.rb Moves the helper Result constant definition out of a before hook.
spec/mongo/id_spec.rb Moves test helper classes into a module to avoid defining constants in examples.
spec/mongo/cursor_spec.rb Replaces an empty each body with to_a to trigger iteration.
spec/mongo/collection/view/readable_spec.rb Adjusts rescue alignment/structure for RuboCop.
spec/mongo/collection/view/change_stream_spec.rb Adjusts rescue alignment/structure for RuboCop.
spec/mongo/auth/user_spec.rb Replaces empty let with an explicit { nil }.
spec/integration/sdam_events_spec.rb Adds parentheses around ambiguous ranges.
spec/integration/heartbeat_events_spec.rb Moves test exception constant out of the example group.
spec/integration/cursor_memory_leak_spec.rb Replaces empty each {} with to_a to fully iterate.
lib/mongo/uri/options_mapper.rb Reorders DSL/constants to satisfy access-modifier linting and adds @api private tags.
lib/mongo/socket/ocsp_verifier.rb Rewrites begin/rescue assignment to satisfy linting without changing behavior.
lib/mongo/protocol/message.rb Moves private instance helpers under an effective private section; adds @api private on class helpers.
lib/mongo/operation/shared/polymorphic_result.rb Adjusts private placement to satisfy linting.
lib/mongo/error/raise_original_error.rb Adds an inline RuboCop disable for intentional Exception inheritance.
lib/mongo/crypt/handle.rb Flattens proc parameter formatting to satisfy layout cops.
.rubocop_todo.yml Removes multiple cop exclusions now fixed in code.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants