Skip to content

Add frozen_string_literal Rubocop Rule#10342

Merged
mitchellhenke merged 2 commits intomainfrom
mitchellhenke/freeze-strings
Apr 2, 2024
Merged

Add frozen_string_literal Rubocop Rule#10342
mitchellhenke merged 2 commits intomainfrom
mitchellhenke/freeze-strings

Conversation

@mitchellhenke
Copy link
Contributor

🛠 Summary of changes

Spurred by conversation on #10340 here, this PR enables the frozen_string_literal rule with a few exceptions.

@mitchellhenke mitchellhenke requested a review from a team March 29, 2024 17:49
Copy link
Contributor

@zachmargolis zachmargolis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! It's a good thing we don't have a "last person to touch a file is its owner" rule! 😉

@matthinz
Copy link
Contributor

This is a big commit--can you point out where the rubocop rule is enabled? I'm not seeing any references to it

@mitchellhenke mitchellhenke force-pushed the mitchellhenke/freeze-strings branch from b9f2269 to 2cd0652 Compare March 29, 2024 17:56
@matthinz
Copy link
Contributor

Ah NM I found it

@mitchellhenke mitchellhenke force-pushed the mitchellhenke/freeze-strings branch 3 times, most recently from 1cba376 to 3e4ebfe Compare March 29, 2024 18:35
Mitchell Henke added 2 commits April 2, 2024 11:29
changelog: Internal, Performance, Add frozen_string_literal Rubocop Rule
@mitchellhenke mitchellhenke force-pushed the mitchellhenke/freeze-strings branch from f8a7926 to 07d721c Compare April 2, 2024 16:29
@mitchellhenke mitchellhenke marked this pull request as ready for review April 2, 2024 16:54
@mitchellhenke mitchellhenke merged commit 7ce91b5 into main Apr 2, 2024
@mitchellhenke mitchellhenke deleted the mitchellhenke/freeze-strings branch April 2, 2024 17:05
@aduth aduth mentioned this pull request Apr 3, 2024
3 tasks
Style/FrozenStringLiteralComment:
Enabled: true
Exclude:
- 'spec/**/*.rb'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would there be any similar benefit to extending this to spec files?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm speculating, but I'd guess no. It can be helpful to freeze strings for performance purposes, but the impact is usually smaller, so I'm not sure how big of an impact it would have on tests.

@aduth aduth mentioned this pull request Apr 4, 2024
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

Successfully merging this pull request may close these issues.

4 participants