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

When the hash key is the same as the hash value, rubocop removes the value. #11446

Closed
mintotsai opened this issue Jan 13, 2023 · 1 comment
Closed

Comments

@mintotsai
Copy link

I think I'm running into this issue as #10401

When the hash key is the same as the hash value, rubocop removes the value.


Expected behavior

The hash value should not be removed if it is the same as the hash key.

Actual behavior

When the hash key is the same as the hash value, rubocop removes the value.

Steps to reproduce the problem

Here are the examples:

render jsonapi_errors: error, status: status
corrects to
render jsonapi_errors: error, status:

direct_upload: { url: url }.merge(params)
corrects to
direct_upload: { url: }.merge(params)

RuboCop version

I'm on rubocop 1.43.0 with vscode ruby-rubocop-revived v0.9.4.

% rubocop -v
1.43.0
@koic
Copy link
Member

koic commented Jan 13, 2023

This is an expected behavior. You can set EnforcedShorthandSyntax: never or EnforcedShorthandSyntax: eigher if you don't want to omit hash values:
https://docs.rubocop.org/rubocop/1.43/cops_style.html#stylehashsyntax

@koic koic closed this as not planned Won't fix, can't repro, duplicate, stale Jan 13, 2023
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

No branches or pull requests

2 participants