-
-
Notifications
You must be signed in to change notification settings - Fork 287
Add autocorrect support for RSpec/MultipleExpectations
#2143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
bquorning
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add test coverage for this line, please?
| corrector.insert_before(hash_node.loc.end, | ||
| ' aggregate_failures: true ') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add test coverage for this line too, please?
| def_node_matcher :aggregate_failures?, <<~PATTERN | ||
| (send _ _ <{ (sym :aggregate_failures) (hash <(pair (sym :aggregate_failures) _) ...>) } ...>) | ||
| PATTERN | ||
| # @!method metadata_present?(node) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # @!method metadata_present?(node) | |
| # @!method metadata_present?(node) |
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.