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

Remove (or disable) Style/BracesAroundHashParameters #7641

Closed
pocke opened this issue Jan 9, 2020 · 4 comments · Fixed by #7643
Closed

Remove (or disable) Style/BracesAroundHashParameters #7641

pocke opened this issue Jan 9, 2020 · 4 comments · Fixed by #7643
Assignees

Comments

@pocke
Copy link
Collaborator

pocke commented Jan 9, 2020

Since Ruby 2.7, the existence of curly braces on the last argument has meaning.

It means, the following codes have different meanings.

foo(x: 1) # x: 1 is a keyword argument
foo({x: 1}) # {x: 1} is a hash

There are the correct pairs of method definitions and method calls.

def foo(x: 1)
end
foo(x: 1)

def foo(hash)
end
foo({x: 1})

For more detail https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/

So I propose removing the cop. I think we should disable the cop by default at least.


Expected behavior

Remove or disable the cop.

Actual behavior

It's available.

Steps to reproduce the problem

nothing

RuboCop version

master

@koic
Copy link
Member

koic commented Jan 9, 2020

I agree with @pocke. I think this proposal makes sense for future Ruby 3. And I think the cop should be removed to smooth the transition from Ruby 2 to Ruby 3.

@bbatsov
Copy link
Collaborator

bbatsov commented Jan 9, 2020

Yeah, agreed. Let's remove it.

@pocke pocke self-assigned this Jan 11, 2020
pocke added a commit to pocke/rubocop that referenced this issue Jan 15, 2020
andreydeineko added a commit to Effilab/style-guide that referenced this issue Feb 18, 2020
andreydeineko added a commit to Effilab/style-guide that referenced this issue Feb 18, 2020
andreydeineko added a commit to Effilab/style-guide that referenced this issue Feb 19, 2020
andreydeineko added a commit to Effilab/style-guide that referenced this issue Feb 19, 2020
andreydeineko added a commit to Effilab/style-guide that referenced this issue Feb 19, 2020
andreydeineko added a commit to Effilab/style-guide that referenced this issue Feb 19, 2020
jgalisteo pushed a commit to nosolosoftware/rubocop-nosolosoftware that referenced this issue Feb 19, 2020
issyl0 added a commit to alphagov/rubocop-govuk that referenced this issue Mar 3, 2020
- As of RuboCop 0.80, this has [been removed](rubocop/rubocop#7641) for compatibility with Ruby 2.7 and later.
@deivid-rodriguez
Copy link
Contributor

Hi @pocke!

Currently the HashSyntax cop also warns foo(x: 1) invocations if configured with the hash rockets style. I'm guessing these offences should also be removed from the Style/HashSyntax cop, right?

jasdeepgosal added a commit to charitywater/cw-style that referenced this issue Jun 24, 2020
Since version ~0.80, rubocop now warns you about new rules and you have to explicitly enable or disable them. 

I reviewed each of these rules and decided to keep them, primarily because I either liked what the rule did or it was trivial, autocorrectable, and I trust the rubocop/rails community. I’m open to changing any of the rules if they prove problematic. 

Docs: https://docs.rubocop.org/rubocop/0.85/versioning.html#pending-cops

I tried upgrading to the latest version (0.86), but that resulted in some gem version conflicts that would’ve required upgrading capyabara, which I already decided I don’t want to deal with yet: charitywater/maji@dd9d67e

BracesAroundHashParameters was removed: rubocop/rubocop#7641

[#172410772]
jasdeepgosal added a commit to charitywater/cw-style that referenced this issue Jun 25, 2020
Since version ~0.80, rubocop now warns you about new rules and you have to explicitly enable or disable them. 

I reviewed each of these rules and decided to keep them, primarily because I either liked what the rule did or it was trivial, autocorrectable, and I trust the rubocop/rails community. I’m open to changing any of the rules if they prove problematic. 

Docs: https://docs.rubocop.org/rubocop/0.85/versioning.html#pending-cops

I tried upgrading to the latest version (0.86), but that resulted in some gem version conflicts that would’ve required upgrading capyabara, which I already decided I don’t want to deal with yet: charitywater/maji@dd9d67e

BracesAroundHashParameters was removed: rubocop/rubocop#7641

[#172410772]
@sandstrom
Copy link

Agree with what @deivid-rodriguez said, it would be awesome if Style/HashSyntax configured with hash_rockets wouldn't complain about keyword arguments, e.g. foo(x: 1).

Also, see #1451

oedbro added a commit to oedbro/plots2 that referenced this issue Oct 3, 2020
 BracesAroundHashParameters has been removed due to updated standards
 for ruby. More info found at:
 rubocop/rubocop#7641
aried3r added a commit to aried3r/webpacker that referenced this issue Oct 6, 2020
Fixes version to avoid sudden CI failures.

Removed Style/BracesAroundHashParameters cop. See:
rubocop/rubocop#7641
aried3r added a commit to aried3r/webpacker that referenced this issue Oct 13, 2020
Fixes version to avoid sudden CI failures.

Removed Style/BracesAroundHashParameters cop. See:
rubocop/rubocop#7641
gauravtiwari pushed a commit to rails/webpacker that referenced this issue Oct 13, 2020
Fixes version to avoid sudden CI failures.

Removed Style/BracesAroundHashParameters cop. See:
rubocop/rubocop#7641
ndguarino added a commit to ndguarino/phi_attrs that referenced this issue Mar 5, 2021
manicmaniac added a commit to manicmaniac/danger-plugin-template that referenced this issue Oct 26, 2021
richardmcmillen added a commit to richardmcmillen/opentelemetry-ruby that referenced this issue Oct 24, 2022
The Style/BracesAroundHashParameters was removed from Rubocop.
See the following issue for more info:
rubocop/rubocop#7641
richardmcmillen added a commit to richardmcmillen/opentelemetry-ruby that referenced this issue Oct 24, 2022
* enable all new cops by default
* Style/BracesAroundHashParameters was removed - see rubocop/rubocop#7641
* LineLength changed group from Metrics to Layout
* disable Gemspec/RequireMFA
richardmcmillen added a commit to richardmcmillen/opentelemetry-ruby that referenced this issue Oct 24, 2022
* enable all new cops by default
* Style/BracesAroundHashParameters was removed - see rubocop/rubocop#7641
* LineLength changed group from Metrics to Layout
* disable Gemspec/RequireMFA
richardmcmillen added a commit to richardmcmillen/opentelemetry-ruby that referenced this issue Oct 24, 2022
* enable all new cops by default
* Style/BracesAroundHashParameters was removed - see rubocop/rubocop#7641
* LineLength changed group from Metrics to Layout
* disable Gemspec/RequireMFA
* autocorrect explicit block over yield
robertlaurin pushed a commit to open-telemetry/opentelemetry-ruby that referenced this issue Oct 24, 2022
* enable all new cops by default
* Style/BracesAroundHashParameters was removed - see rubocop/rubocop#7641
* LineLength changed group from Metrics to Layout
* disable Gemspec/RequireMFA
* autocorrect explicit block over yield

Co-authored-by: Andrew Hayworth <ahayworth@gmail.com>
EmilioCristalli added a commit to cedarcode/mi_carrera that referenced this issue Jan 11, 2023
EmilioCristalli added a commit to cedarcode/mi_carrera that referenced this issue Jan 13, 2023
EmilioCristalli added a commit to cedarcode/mi_carrera that referenced this issue Jan 13, 2023
KingTiger001 added a commit to KingTiger001/Rails-web-pack-project that referenced this issue Jan 15, 2023
Fixes version to avoid sudden CI failures.

Removed Style/BracesAroundHashParameters cop. See:
rubocop/rubocop#7641
EmilioCristalli added a commit to cedarcode/mi_carrera that referenced this issue Jan 20, 2023
smartech7 pushed a commit to smartech7/ruby-webpacker that referenced this issue Aug 4, 2023
Fixes version to avoid sudden CI failures.

Removed Style/BracesAroundHashParameters cop. See:
rubocop/rubocop#7641
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 a pull request may close this issue.

5 participants