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/SpaceInsideArrayLiteralBrackets should correct empty lines #7509

Closed
ayacai115 opened this issue Nov 17, 2019 · 5 comments
Closed

Layout/SpaceInsideArrayLiteralBrackets should correct empty lines #7509

ayacai115 opened this issue Nov 17, 2019 · 5 comments

Comments

@ayacai115
Copy link

ayacai115 commented Nov 17, 2019

Expected behavior

foo = [
]
foo

When I rubocop -a, rubocop corrects the empty line.

foo = []
foo

Actual behavior

When I rubocop -a...

Offenses:

sample.rb:1:7: C: [Corrected] Layout/SpaceInsideArrayLiteralBrackets: Do not use space inside empty array brackets.
foo = [ ...
      ^

1 file inspected, 1 offense detected, 1 offense corrected

But it's not actually corrected and I keep getting this message.
I think this is a bug.

Steps to reproduce the problem

$ vi sample.rb
foo = [
]
foo
$ rubocop -a sample.rb
Inspecting 1 file
C

Offenses:

sample.rb:1:7: C: [Corrected] Layout/SpaceInsideArrayLiteralBrackets: Do not use space inside empty array brackets.
foo = [ ...
      ^

1 file inspected, 1 offense detected, 1 offense corrected

But it's not corrected and I get the same message again.

$ rubocop -a sample.rb
Inspecting 1 file
C

Offenses:

sample.rb:1:7: C: [Corrected] Layout/SpaceInsideArrayLiteralBrackets: Do not use space inside empty array brackets.
foo = [ ...
      ^

1 file inspected, 1 offense detected, 1 offense corrected

RuboCop version

$ rubocop -V
0.57.2 (using Parser 2.5.1.0, running on ruby 2.5.1 x86_64-darwin16)
@ayacai115
Copy link
Author

ayacai115 commented Nov 17, 2019

Same issue here, a different proposal though: #5585

@ayacai115
Copy link
Author

ayacai115 commented Nov 17, 2019

I'm trying to create a PR to fix this bug... but if anybody can, that'd be very helpful.

@buehmann
Copy link
Contributor

@ayacai115 This seems to do the trick: master...buehmann:empty-array-literal/7509 – Could you take it from there? We need a spec for this case and a changelog entry for a full PR.

@ayacai115
Copy link
Author

ayacai115 commented Nov 17, 2019

@buehmann Great! I'll add a spec and a changelog entry.

@ayacai115
Copy link
Author

I created a PR: #7511

@koic koic closed this as completed in 7b0fbc6 Nov 20, 2019
koic added a commit that referenced this issue Nov 20, 2019
…ayLiteralBrackets

[Fix #7509] Layout/SpaceInsideArrayLiteralBrackets to correct empty lines
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

2 participants