Rubocop autocorrect for FrozenStringLiteralComment not working Rubocop autocorrect for FrozenStringLiteralComment not working ruby-on-rails ruby-on-rails

Rubocop autocorrect for FrozenStringLiteralComment not working


This is a breaking change introduced in the version 0.87 (see the issue).

Quoting from there:

rubocop -a does all autocorrections, including unsafe ones. One has to add --safe-auto-correct to exclude unsafe ones.

You should use the -A flag now to safe and/or unsafe autocorrect your files:

rubocop -a / --autocorrect no longer run unsafe corrections; rubocop -A / --autocorrect-all run both safe and unsafe corrections. Options --safe-autocorrect is deprecated

It should work for you as:

bundle exec rubocop -A --only Style/FrozenStringLiteralComment