Add autocorrect support for RSpec/MultipleExpectations#2143
Draft
gildesmarais wants to merge 1 commit into
Draft
Add autocorrect support for RSpec/MultipleExpectations#2143gildesmarais wants to merge 1 commit into
RSpec/MultipleExpectations#2143gildesmarais wants to merge 1 commit into
Conversation
bquorning
reviewed
Dec 17, 2025
Collaborator
bquorning
left a comment
There was a problem hiding this comment.
Hi @gildesmarais and thank you for the PR; sorry it took us a while to respond.
I am not sure about why you get those two warnings/errors locally, and I am also not sure how to replicate it.
It looks like you need to add a couple more tests to get 100% coverage. (The coverage results can be seen locally in coverage/index.html after running rspec).
Also please run rake generate_cops_documentation and add docs/ to the commit.
| if node.arguments.empty? | ||
| # Handle cases like `it { ... }` vs `it(...) { ... }` | ||
| loc, str = if node.loc.begin | ||
| [node.loc.begin, ':aggregate_failures'] |
Collaborator
There was a problem hiding this comment.
Could you add test coverage for this line, please?
Comment on lines
+188
to
+189
| corrector.insert_before(hash_node.loc.end, | ||
| ' aggregate_failures: true ') |
Collaborator
There was a problem hiding this comment.
Could you add test coverage for this line too, please?
bquorning
reviewed
Dec 17, 2025
| def_node_matcher :aggregate_failures?, <<~PATTERN | ||
| (send _ _ <{ (sym :aggregate_failures) (hash <(pair (sym :aggregate_failures) _) ...>) } ...>) | ||
| PATTERN | ||
| # @!method metadata_present?(node) |
Collaborator
There was a problem hiding this comment.
Suggested change
| # @!method metadata_present?(node) | |
| # @!method metadata_present?(node) |
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.
Adds autocorrect support for
RSpec/MultipleExpectationscop, handling hash or :symbol example metadata.Rake fails due to apparently unrelated changes
If that's related to the changes, I'd appreciate a pointer where to fix them. Thank you. :)
Before submitting the PR make sure the following are checked:
master(if not - rebase it).CHANGELOG.mdif the new code introduces user-observable changes.bundle exec rake) passes (be sure to run this locally, since it may produce updated documentation that you will need to commit).If you have created a new cop:
config/default.yml.Enabled: pendinginconfig/default.yml.Enabled: truein.rubocop.yml.VersionAdded: "<<next>>"indefault/config.yml.If you have modified an existing cop's configuration options:
VersionChanged: "<<next>>"inconfig/default.yml.