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

Style/RedundantFetchBlock: No offence for string literals in file without frozen_string_literal: true #11803

Closed
Earlopain opened this issue Apr 15, 2023 · 0 comments · Fixed by #11804

Comments

@Earlopain
Copy link
Contributor

Documentation says that string literals in code like ENV.fetch("RAILS_ENV") { "development" } should always be rewritten as ENV.fetch("RAILS_ENV", "development"). However I'm not getting any errors for this.

This seems to stem from the fact that I have disabled the frozen string literals cop disabled/don't have the magic comment in the file. It would be nice if the documentation would mention this somewhere.


RuboCop version

$ [bundle exec] rubocop -V
1.50.1 (using Parser 3.2.2.0, rubocop-ast 1.28.0, running on ruby 3.1.4) [x86_64-linux-musl]
  - rubocop-erb 0.2.4
  - rubocop-rails 2.19.0
koic added a commit to koic/rubocop that referenced this issue Apr 15, 2023
Fixes rubocop#11803.

This PR adds a note to the doc for `Style/RedundantFetchBlock` about the difference
in behavior between enabled and disabled frozen string magic literal comment.
bbatsov pushed a commit that referenced this issue Apr 17, 2023
Fixes #11803.

This PR adds a note to the doc for `Style/RedundantFetchBlock` about the difference
in behavior between enabled and disabled frozen string magic literal comment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants