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

Style/EachWithObject autocorrect should not leave an empty line #5534

Closed
flyerhzm opened this issue Feb 1, 2018 · 0 comments
Closed

Style/EachWithObject autocorrect should not leave an empty line #5534

flyerhzm opened this issue Feb 1, 2018 · 0 comments
Labels

Comments

@flyerhzm
Copy link
Contributor

flyerhzm commented Feb 1, 2018

Style/EachWithObject autocorrect leaves an empty line which doesn't look good.


Expected behavior

It should remove empty line.

Actual behavior

It leaves an empty line.

Steps to reproduce the problem

$ cat test.rb
[1, 2, 3].inject({}) do |h, i|
  h[i] = i
  h
end
$ rubocop -a --only Style/EachWithObject ./test.rb
$ cat test.rb
[1, 2, 3].each_with_object({}) do |i, h|
  h[i] = i

end

But I expect the code to be

[1, 2, 3].each_with_object({}) do |i, h|
  h[i] = i
end

RuboCop version

$ rubocop -V
0.52.1 (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
Projects
None yet
Development

No branches or pull requests

2 participants