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

Incorrect autocorrection of increment #4109

Closed
tarkeshwar-thakur opened this issue Mar 12, 2017 · 1 comment
Closed

Incorrect autocorrection of increment #4109

tarkeshwar-thakur opened this issue Mar 12, 2017 · 1 comment
Labels

Comments

@tarkeshwar-thakur
Copy link

i=i+1
gets autocorrected as:
i+ = 1

which raises syntax error with ruby 2.1.8.


Expected behavior

i += 1

Actual behavior

i+ = 1

Steps to reproduce the problem

$ cat increment.rb
i=i+1
$ rubocop -a increment.rb
Inspecting 1 file
E

Offenses:

increment.rb:1:1: C: [Corrected] Use self-assignment shorthand +=.
i=i+1
^^^^^
increment.rb:1:2: C: [Corrected] Surrounding space missing for operator =.
i=i+1
^
increment.rb:1:4: C: [Corrected] Surrounding space missing for operator +.
i=i+1
^
increment.rb:1:4: E: unexpected token tEQL
(Using Ruby 2.1 parser; configure using TargetRubyVersion parameter, under AllCops)
i+ = 1
^

1 file inspected, 4 offenses detected, 3 offenses corrected
$ cat increment.rb
i+ = 1

RuboCop version

$ rubocop -V
0.47.1 (using Parser 2.4.0.0, running on ruby 2.1.8 x86_64-darwin15.0)
@bbatsov bbatsov added the bug label Mar 12, 2017
@bbatsov
Copy link
Collaborator

bbatsov commented Mar 12, 2017

Likely a bad interaction with some other auto-correct.

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

2 participants