Skip to content
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

Fix a false positive for RSpec/RepeatedExampleGroupBody when pending or skip have argument(s). #1039

Merged
merged 1 commit into from Apr 28, 2021

Conversation

Tietew
Copy link
Contributor

@Tietew Tietew commented Oct 12, 2020

RSpec/RepeatedExampleGroupBody does not register offenses when example group body is skip or pending.

describe 'alpha' do
  skip
end

describe 'bravo' do
  skip
end

But each of them has a same argument, registers offenses.

describe 'alpha' do
^^^^^^^^^^^^^^^^^^^ Repeated describe block body
  skip 'something needed'
end

describe 'bravo' do
^^^^^^^^^^^^^^^^^^^ Repeated describe block body
  skip 'something needed'
end

I thinks this is a false positive.
This PR allows this.


Before submitting the PR make sure the following are checked:

  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Updated documentation.
  • Added an entry to the CHANGELOG.md if the new code introduces user-observable changes.
  • The build (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:

  • Added the new cop to config/default.yml.
  • The cop is configured as Enabled: pending in config/default.yml.
  • The cop documents examples of good and bad code.
  • The tests assert both that bad code is reported and that good code is not reported.
  • Set VersionAdded in default/config.yml to the next minor version.

If you have modified an existing cop's configuration options:

  • Set VersionChanged in config/default.yml to the next major version.

Copy link
Member

@pirj pirj left a comment

Choose a reason for hiding this comment

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

Thanks!

@pirj pirj requested a review from Darhazer October 12, 2020 09:49

context 'processed' do
skip 'some reason'
end
Copy link
Member

Choose a reason for hiding this comment

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

Now when I look at it, it seems that there's something wrong, and it's the repeated context title.
Do you mind to make them different?
The example with describe '#load' do isn't the best reference, it's a miss.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll try update them to clarify use case.

@Tietew Tietew force-pushed the pending_with_arguments branch 2 times, most recently from 3252c19 to e30b0c3 Compare October 13, 2020 08:10
@bquorning
Copy link
Collaborator

@pirj Are you happy with this PR as it is? (We can resolve the Changelog conflict on merge).

Copy link
Member

@pirj pirj left a comment

Choose a reason for hiding this comment

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

Thanks!

@bquorning bquorning merged commit d2daba7 into rubocop:master Apr 28, 2021
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.

None yet

4 participants