Skip to content

Skip reordering positional arguments for include_* in RSpec/SortMetadata #1437

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

Merged
merged 1 commit into from
Oct 25, 2022

Conversation

pirj
Copy link
Member

@pirj pirj commented Oct 24, 2022

fixes #1435

The arguments to include_examples is not regular metadata, it's arguments passed to the shared groups.
We should not reorder positional arguments, and reordering hash arguments can also have side effects, e.g. for .each and keys.first.

See 2.3 of this reference.
It might make sense to still reorder metadata of configuration-level include_context, but I'd rather skip that.


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).

@pirj pirj self-assigned this Oct 24, 2022
@pirj pirj changed the title Skip reordering positional arguments for include_* Skip reordering positional arguments for include_* in RSpec/SortMetadata Oct 24, 2022
@pirj pirj requested review from bquorning and Darhazer October 24, 2022 19:32
@pirj pirj force-pushed the fix-mistaken-positional-arguments-reordering branch from ddfd4a3 to db7b7f4 Compare October 24, 2022 19:34
@pirj pirj force-pushed the fix-mistaken-positional-arguments-reordering branch from db7b7f4 to 2d9658a Compare October 24, 2022 21:21
@bquorning
Copy link
Collaborator

@pirj Are you saying we should disable / remove this cop again? I am myself having second thoughts about its usefulness.

@pirj
Copy link
Member Author

pirj commented Oct 24, 2022 via email

@bquorning bquorning merged commit 9210bb6 into master Oct 25, 2022
@bquorning bquorning deleted the fix-mistaken-positional-arguments-reordering branch October 25, 2022 06:14
bquorning added a commit that referenced this pull request Oct 25, 2022
…ts-reordering

Skip reordering positional arguments for include_* in RSpec/SortMetadata
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.

RSpec/SortMetadata autocorrect broke code for it_behaves_like
2 participants