We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi, I found a case that the auto-correction of the Style/BracesAroundHashParameters cop results in a syntax error.
Style/BracesAroundHashParameters
.rubocop.yml:
.rubocop.yml
Style/TrailingCommaInHashLiteral: Enabled: true EnforcedStyleForMultiline: comma Style/TrailingCommaInArguments: Enabled: true EnforcedStyleForMultiline: comma Style/BracesAroundHashParameters: Enabled: true
a.rb:
a.rb
hello( :bob, { a: 1, b: 2, }, )
RuboCop auto-corrects a.rb like this:
hello( :bob, a: 1, b: 2, )
RuboCop auto-crrects a.rb like this:
hello( :bob, a: 1, b: 2, , )
The result is obviously an syntax error 😱
$ ruby -c a.rb a.rb:5: syntax error, unexpected ',', expecting ')'
bundle exec rubocop -a a.rb
$ bundle exec rubocop -V 0.58.2 (using Parser 2.5.1.2, running on ruby 2.4.1 x86_64-darwin16)
The text was updated successfully, but these errors were encountered:
[Fix rubocop#6175] BracesAroundHashParameters auto-correct syntax err…
81a29e0
…or with trailing comma
cb06670
No branches or pull requests
Hi,
I found a case that the auto-correction of the
Style/BracesAroundHashParameters
cop results in a syntax error..rubocop.yml
:a.rb
:Expected behavior
RuboCop auto-corrects
a.rb
like this:Actual behavior
RuboCop auto-crrects
a.rb
like this:The result is obviously an syntax error 😱
Steps to reproduce the problem
bundle exec rubocop -a a.rb
RuboCop version
The text was updated successfully, but these errors were encountered: