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/InfiniteLoop autofix may introduce syntax errors #3207

Closed
matkoniecz opened this issue Jun 8, 2016 · 1 comment
Closed

Style/InfiniteLoop autofix may introduce syntax errors #3207

matkoniecz opened this issue Jun 8, 2016 · 1 comment

Comments

@matkoniecz
Copy link

matkoniecz commented Jun 8, 2016

Expected behavior

Style/InfiniteLoop autofix produces equivalent code or do nothing

Actual behavior

puts 'a' while true

is replaced by

puts 'a' loop do

resulting in

test.rb:1: syntax error, unexpected tIDENTIFIER, expecting end-of-input
puts 'a' loop do

Steps to reproduce the problem

Run rubocop -a on file with

puts 'a' while true

RuboCop version

Include the output of rubocop -V:

$ rubocop -V
0.40.0 (using Parser 2.3.1.2, running on ruby 2.3.1 x86_64-linux-gnu)
@matkoniecz
Copy link
Author

Thanks!

jonas054 added a commit to jonas054/rubocop that referenced this issue Jun 19, 2016
Second correction for rubocop#3207. Change it so we auto-correct
instead of accept modifier forms. Also add handling of
begin-end-while.
bbatsov pushed a commit that referenced this issue Jun 19, 2016
Second correction for #3207. Change it so we auto-correct
instead of accept modifier forms. Also add handling of
begin-end-while.
Neodelf pushed a commit to Neodelf/rubocop that referenced this issue Oct 15, 2016
Neodelf pushed a commit to Neodelf/rubocop that referenced this issue Oct 15, 2016
Second correction for rubocop#3207. Change it so we auto-correct
instead of accept modifier forms. Also add handling of
begin-end-while.
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