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

FrozenStringLiteralComment: Autocorrect not working #8360

Closed
leoarnold opened this issue Jul 18, 2020 · 2 comments
Closed

FrozenStringLiteralComment: Autocorrect not working #8360

leoarnold opened this issue Jul 18, 2020 · 2 comments

Comments

@leoarnold
Copy link
Contributor

Expected behavior

Given the test file

puts 'Hello'

when using RuboCop defaults
and running

$ rubocop -a test.rb

then it should insert a frozen string literal comment.

Actual behavior

The test file is left unchanged. Output:

$ rubocop -a test.rb
Inspecting 1 file
C

Offenses:

test.rb:1:1: C: Style/FrozenStringLiteralComment: Missing frozen string literal comment.
puts 'Hello'
^

1 file inspected, 1 offense detected

RuboCop version

$ [bundle exec] rubocop -V
0.88.0 (using Parser 2.7.1.4, rubocop-ast 0.1.0, running on ruby 2.5.8 x86_64-linux)
@koic
Copy link
Member

koic commented Jul 18, 2020

The rubocop -a option behaviour has been changed from RuboCop 0.87.
https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md#changes-2

Can you use rubocop -A or rubocop --auto-correct-all instead, for Style/FrozenStringLiteralComment unsafe cop?
https://docs.rubocop.org/rubocop/0.88/usage/auto_correct.html

Thank you.

@koic koic closed this as completed Jul 18, 2020
@marcandre
Copy link
Contributor

It would be nice if the potentially correctable offenses was shown; I opened #8362

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

3 participants