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/ConditionalAssignment autocorrect does not work with constants #2646

Closed
aevernon opened this issue Jan 15, 2016 · 1 comment
Closed

Comments

@aevernon
Copy link

If I run rubocop -a on the following code:

if fruit == 'juicy'
  CHOICE = 'apple'.freeze
else
  CHOICE = 'grape'.freeze
end

It autocorrects it to this:

 = if fruit == 'juicy'
  'apple'.freeze
else
  'grape'.freeze
end

But it should be this:

CHOICE = if fruit == 'juicy'
  'apple'.freeze
else
  'grape'.freeze
end
$ rubocop -V
0.36.0 (using Parser 2.3.0.1, running on ruby 2.2.4 x86_64-linux)
@segiddins
Copy link
Contributor

I have a fix for this coming up

bbatsov added a commit that referenced this issue Jan 16, 2016
[Fix #2646] Auto-correcting assignment to a constant in `Style/Condit…
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