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 false-negative and error for RSpec/MetadataStyle #1947

Merged

Conversation

cbliard
Copy link
Contributor

@cbliard cbliard commented Aug 8, 2024

When RSpec/MetadataStyle cop is used with EnforcedStyle: hash, offenses must be registered only for metadata arguments being symbols.

This code:

describe 'Something', a, b do
end

would previously report

describe 'Something', a, b do
                      ^ Use hash style for metadata.
end

And this code:

describe 'Something', a, :b do
end

would previously produce the following exception: "NoMethodError: undefined method `value' for an instance of RuboCop::AST::SendNode".


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

@cbliard cbliard requested a review from a team as a code owner August 8, 2024 16:22
@cbliard cbliard force-pushed the fix-metadata-style-cop-with-non-literal-args branch from d6d829b to 2c92440 Compare August 8, 2024 16:40
When RSpec/MetadataStyle cop is used with `EnforcedStyle: hash`,
offenses must be registered only for metadata arguments being symbols.

It was previously producing an exception if a variable was used in the
metadata arguments (except if it was the last one).
@cbliard cbliard force-pushed the fix-metadata-style-cop-with-non-literal-args branch from 2c92440 to dbd87bb Compare August 8, 2024 16:43
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.

Thank you!

@pirj pirj requested a review from a team August 8, 2024 17:47
@pirj pirj merged commit e02576f into rubocop:master Aug 8, 2024
24 checks passed
@cbliard cbliard deleted the fix-metadata-style-cop-with-non-literal-args branch August 8, 2024 19:04
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.

3 participants