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

Infinite loop with Layout/SpaceInsideArrayLiteralBrackets and Layout/SpaceInsideReferenceBrackets #5289

Closed
aquach opened this issue Dec 20, 2017 · 3 comments
Labels

Comments

@aquach
Copy link

aquach commented Dec 20, 2017

Expected behavior

Here's the configuration:

Layout/SpaceInsideArrayLiteralBrackets:
  EnforcedStyle: space

And here's the code:

a = []
a[[ 1, 2 ]]

I expect this to pass. SpaceInsideArrayLiteralBrackets should be happy since there is a space inside the brackets. SpaceInsideReferenceBrackets should be happy since there are no spaces in between the [[ and ]]. It should complain if I were doing a[ [ 1, 2 ] ], but I'm not.

Actual behavior

When I use auto-correct, the two cops fight each other and create an infinite loop.

Steps to reproduce the problem

Create the files above as style.yml and a.rb, then run:

rubocop -c style.yml a.rb  --auto-correct

RuboCop version

0.52.0 (using Parser 2.4.0.2, running on ruby 2.2.2 x86_64-linux)

@pocke pocke added the bug label Dec 21, 2017
@garettarrowood
Copy link
Contributor

This is an issue in Layout/SpaceInsideReferenceBrackets with right_bracket detection. Thanks for the report. I'll take a look at this soon.

@aquach
Copy link
Author

aquach commented Dec 21, 2017

Cheers, thanks!

@ghost
Copy link

ghost commented Dec 22, 2017

Most epic line in this issue so far :)

When I use auto-correct, the two cops fight each other and create an infinite loop.

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

3 participants