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
Rubocop auto-correcting sigil and frozen_string_literal #46
Comments
Edit: I initially tested this in shopify core and it was working fine. I don't think it's specific to a version now. I realized now any version works properly on core. Still WIP. I tested this on v0.3.7 and functionality is working as expected. I'll try to bisect the specific commit that introduced this. Nothing stood out to me on first glance. Output on 0.3.7:
|
Team found out that this was due to the new version of Rubocop being used. There was a significant change in Rubocop at version 0.87 for Lint/FrozenStringLiterals. As a result Ref: rubocop/rubocop#8360 (comment) and rubocop/rubocop#8529 is the PR that made the change. Closing this issue as it's not |
Hi folks!
When creating new files in Rails applications and running
rubocop -a
to let it auto-correct the files, rubocop autocorrects by adding the sigil correctly, but then it can't autocorrect the missing frozen string literal comment.I've tried this in two different repos, one on v0.4.0 and one on v0.4.1 and both behave the same way.
Here's some output:
I created the following class app/models/this_test.rb:
Ran
rubocop -a
:Checked the file, which now had a sigil but no
# frozen_string_literal: true
:Running
rubocop
, it outputs the expected:Running
rubocop -a
a second time to see if it gets less confused now that the sigil has already been fixed, but it still can't fix it:cc @Shopify/sorbet
The text was updated successfully, but these errors were encountered: