We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
i=i+1 gets autocorrected as: i+ = 1
which raises syntax error with ruby 2.1.8.
i += 1
i+ = 1
$ 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 -V 0.47.1 (using Parser 2.4.0.0, running on ruby 2.1.8 x86_64-darwin15.0)
The text was updated successfully, but these errors were encountered:
Likely a bad interaction with some other auto-correct.
Sorry, something went wrong.
[Fix rubocop#4109] Fix incorrect auto correction in `Style/SelfAssign…
3f226d4
…ment` cop
Style/SelfAssignment
83e8dbf
No branches or pull requests
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
The text was updated successfully, but these errors were encountered: