Rubocop: Auto-correct bug with percentage literal and square brackets

Created on 20 Mar 2017  路  3Comments  路  Source: rubocop-hq/rubocop

Steps to reproduce the problem

Run rubocop -a on the following code:

TERMINAL_STATES  = %w[rejected failed complete undefined]

Actual behavior

Results in the following code:

TERMINAL_STATES = [%w(rejected failed complete undefined)].freeze

Which ultimately changes the behaviour of the code.

Expected behavior

TERMINAL_STATES = %w(rejected failed complete undefined).freeze

RuboCop version

$ rubocop -V
0.47.1 (using Parser 2.4.0.0, running on ruby 2.3.0 x86_64-darwin16)

Most helpful comment

This was fixed by https://github.com/bbatsov/rubocop/pull/3962, but isn't released yet.

@bbatsov, we've had a few reports of this problem. I suggest releasing in the next couple weeks, if you can. How can I help?

All 3 comments

This was fixed by https://github.com/bbatsov/rubocop/pull/3962, but isn't released yet.

@bbatsov, we've had a few reports of this problem. I suggest releasing in the next couple weeks, if you can. How can I help?

0.48.0 is now released. Can we close this @cabello? 馃檪

Sure, I will update the gem on my projects, thank you very much!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bbugh picture bbugh  路  3Comments

tedPen picture tedPen  路  3Comments

Aqualon picture Aqualon  路  3Comments

deivid-rodriguez picture deivid-rodriguez  路  3Comments

bbatsov picture bbatsov  路  3Comments