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 conflict between Hash#values_at and "Parallel Assignment" #936

Merged
merged 1 commit into from Nov 23, 2023

Conversation

ydakuka
Copy link
Contributor

@ydakuka ydakuka commented Nov 22, 2023

No description provided.

@ydakuka ydakuka changed the title Resolve conflict between Hash#values_at and "Parallel Assignment" Fix conflict between Hash#values_at and "Parallel Assignment" Nov 22, 2023
README.adoc Outdated
@@ -2297,7 +2297,7 @@ Prefer the use of exceptions from the standard library over introducing new exce
=== Parallel Assignment [[parallel-assignment]]

Avoid the use of parallel assignment for defining variables.
Parallel assignment is allowed when it is the return of a method call, used with the splat operator, or when used to swap variable assignment.
Parallel assignment is allowed when it is the return of a method call, used with the splat operator, or when used to swap variable assignment, or `Hash#values_at` and `Hash#fetch_values`.
Copy link
Contributor Author

@ydakuka ydakuka Nov 23, 2023

Choose a reason for hiding this comment

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

These built-in methods are very convenient. However, there are many such methods, so it is difficult to come to a common solution without marking them as "bad".

Copy link
Collaborator

Choose a reason for hiding this comment

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

Those are method calls, so it's already covered in this sentence.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe the language could to be tweaked to something like "return of a method call (e.g. Hash#values_at)..." so this is clearer.

README.adoc Outdated
@@ -4404,18 +4404,25 @@ batman.fetch(:powers, obtain_batman_powers) # obtain_batman_powers is an expensi
batman.fetch(:powers) { obtain_batman_powers }
----

=== `Hash#values_at` [[hash-values-at]]
=== `Hash#values_at` [[hash-values-at-and-fetch-values]]
Copy link
Collaborator

Choose a reason for hiding this comment

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

You should check if something in RuboCop doesn't refer to this anchor before changing it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, there are no links to this anchor.

@bbatsov bbatsov merged commit 5dcdd37 into rubocop:master Nov 23, 2023
3 checks passed
@ydakuka ydakuka deleted the fix-hash-values-at branch November 23, 2023 10:07
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

2 participants