Open
Conversation
Contributor
There was a problem hiding this comment.
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.
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.
This removes exceptions for several more cops.