-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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/EmptyLiteral and frozen_string_literal generate broken code #9773
Comments
The current |
8 tasks
@adfoster-r7 thanks, I opened a PR to fix this. |
dvandersluis
added a commit
to dvandersluis/rubocop
that referenced
this issue
May 5, 2021
…for `String.new` when `Style/FrozenStringLiteral` is enabled.
koic
added a commit
that referenced
this issue
May 5, 2021
[Fix #9773] Fix `Style/EmptyLiteral` to not register offenses for `String.new` when `Style/FrozenStringLiteral` is enabled
8 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected behavior
Example made up program showing the issue:
Usage:
Actual behavior
The
Style/EmptyLiteral
rule combined with thefrozen_string_literal
generates an invalid program:Program error:
Example rules:
Interestingly this problem only arises if the file doesn't already have the
frozen_string_literal
rule, so having the frozen string literal comment beforehand doesn't actually break the program as the Style/EmptyLiteral rule doesn't run.Steps to reproduce the problem
Create a file with the example text above, and run
rubocop -A foo.rb
RuboCop version
The text was updated successfully, but these errors were encountered: