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
[Fix #7509] Layout/SpaceInsideArrayLiteralBrackets to correct empty lines #7511
[Fix #7509] Layout/SpaceInsideArrayLiteralBrackets to correct empty lines #7511
Conversation
8bed5b8
to
7b0fbc6
Compare
@@ -12,12 +12,11 @@ class << self | |||
def empty_corrections(processed_source, corrector, empty_config, | |||
left_token, right_token) | |||
@processed_source = processed_source | |||
range = range_between(left_token.end_pos, right_token.begin_pos) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@buehmann Thanks for the suggestion!
master...buehmann:empty-array-literal/7509
Normally, the edge case that comes up for these kinds of cops is with comments, e.g.: foo = [
# Intentionally left empty
] |
@Drenmi What I'd like to fix is that rubocop raises a warning and says "corrected" but it's not actually corrected, which is a bug. Regarding your suggestion, it's about how the syntax rule should be, so maybe we can discuss in another issue? |
I see. 🙂 Yes. My comment is a bit tangential then, although fixing the bug is likely going to cause comments to be destroyed on auto-correct, so I think we should at least open a new issue for it, if it's not in scope of this PR. 👍 |
That's not an issue here because the "empty brackets" detection works on the token level. |
Thanks! |
Fixed Layout/SpaceInsideArrayLiteralBrackets to correct empty lines.
See #7509 for details.
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).bundle exec rake default
. It executes all tests and RuboCop for itself, and generates the documentation.