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

Layout/BlockEndNewline cop introduces trailing whitespaces #4866

Closed
bgeuken opened this issue Oct 16, 2017 · 0 comments
Closed

Layout/BlockEndNewline cop introduces trailing whitespaces #4866

bgeuken opened this issue Oct 16, 2017 · 0 comments

Comments

@bgeuken
Copy link
Contributor

bgeuken commented Oct 16, 2017

Expected behavior

The Layout/BlockEndNewline cop is introducing trailing whitespaces when doing the auto-correct.

Here is a diff of the rspec test for that cop. I would expect that it doesn't introduce trailing whitespaces:

     expect(new_source).to eq(['test do',
-                              '  foo ',
+                              '  foo',
                               'end',
                               ''].join("\n"))

Actual behavior

Running the auto-correct introduces trailing whitespaces.

Steps to reproduce the problem

Adjust the test like done above.

RuboCop version

0.49.1 as well as master branch

bgeuken added a commit to bgeuken/rubocop that referenced this issue Oct 29, 2017
The auto-correct of the Layout/BlockEndNewline cop moves closing block
delimiters to a separate line.
When doing this, the auto-correct was not taking into account the
whitespaces that seperate the code of the block from it's delimiter.
Therefore it introduced trailing whitespaces when auto-correcting.

Fixes rubocop#4866
bbatsov pushed a commit that referenced this issue Nov 5, 2017
The auto-correct of the Layout/BlockEndNewline cop moves closing block
delimiters to a separate line.
When doing this, the auto-correct was not taking into account the
whitespaces that seperate the code of the block from it's delimiter.
Therefore it introduced trailing whitespaces when auto-correcting.

Fixes #4866
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