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

multiline indent for Style/BracesAroundHashParameters autocorrect #5291

Closed
flyerhzm opened this issue Dec 21, 2017 · 0 comments
Closed

multiline indent for Style/BracesAroundHashParameters autocorrect #5291

flyerhzm opened this issue Dec 21, 2017 · 0 comments

Comments

@flyerhzm
Copy link
Contributor

For multiline hash parameter autocorrect

Expected behavior

it expects to keep the original indent for last line

Actual behavior

it removes original indent for last line

Steps to reproduce the problem

$ cat test_spec.rb
require 'spec_helper'

RSpec.describe Test do
  it 'is a test' do
    expect(Test.result).to eq({
      foo: 'bar',
      bar: 'foo'
    })
  end
end
$ rubocop -a --only Style/BracesAroundHashParameters ./test_spec.rb
$ cat test_spec.rb
require 'spec_helper'

RSpec.describe Test do
  it 'is a test' do
    expect(Test.result).to eq(
      foo: 'bar',
      bar: 'foo'
)
  end
end

But I expect the code to be

require 'spec_helper'

RSpec.describe Test do
  it 'is a test' do
    expect(Test.result).to eq(
      foo: 'bar',
      bar: 'foo'
    )
  end
end

RuboCop version

$ rubocop -V
0.52.0 (using Parser 2.4.0.2, running on ruby 2.4.3 x86_64-darwin17)
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

1 participant