-
-
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
FrozenStringLiteralComment's 'when_needed' style is confusing #2739
Comments
@rrosenblum Any comment? |
@mvz sorry for not getting back to you sooner. You are right about the frozen string literal comment not being needed in a file if the file contains a call to In hind site, I think this configuration is going to prove fairly useless and add more confusion than positive gain. I will put in a PR to remove both configurations, make the code function as the I don't know how many users actually dig through the documentation and read up on disabled cops. It might be nice if we had a way to enable this cop by default if the target Ruby version is 2.3+ or provide a message suggesting that this cop be enabled. |
@rrosenblum You could just ensure that the file has at least one string literal in it. |
It seems so simple. I like it. What do you think is the percentage of files that contain no string literals compared to those that do? Is it worth it? |
(Shrugs) |
Haha. We can wait for @bbatsov and others to chime in with their opinions. |
@rrosenblum thanks for the explanation. I'll leave the cop disabled for now and keep an eye on the developments. |
Welcome. The |
@rrosenblum yes, I actually went ahead and used |
…ent to all files targeted to Ruby 2.3+
…eeded [Fix #2739] FrozenStringLiteralComment when_needed adds a comment to all files targeted to Ruby 2.3+
As I understand it, the 'when_needed' style only requires a frozen string literal comment if a call to
String#freeze
is present in the file. This seems weird, since once the comment is in place, the call is no longer needed.Am I missing something?
The text was updated successfully, but these errors were encountered: