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

Remove Performance/UnfreezeString cop #22

Merged
merged 1 commit into from
Nov 3, 2024

Conversation

koic
Copy link
Contributor

@koic koic commented Nov 3, 2024

This PR removes Performance/UnfreezeString cop.

Starting with Ruby 3.3, the aim of this cop to improve performance by replacing String#dup with String#+@ no longer holds meaning.

Currently, Rails 8.0 (rc2) supports Ruby 3.2 and above, but support for Ruby 3.2 will likely be dropped in a future version of Rails. When that time comes, any use of String#+@ instead of String#dup at the application layer will be unnecessary.

Since this is enforced for performance rather than style, I think it makes sense to disable this cop.

This is a suggestion to disable a cop that will eventually become irrelevant, from the perspective of maintaining RuboCop Performance. I understand that rubocop-rails-omakase does not expect configuration changes, so please feel free to close this if it doesn’t fit.

This PR removes `Performance/UnfreezeString` cop.

Starting with Ruby 3.3, the aim of this cop to improve performance by replacing `String#dup` with `String#+@` no longer holds meaning.

- rubocop/rubocop-performance#384
- rubocop/rubocop-performance#418

Currently, Rails 8.0 (rc2) supports Ruby 3.2 and above, but support for Ruby 3.2 will likely be dropped in a future version of Rails.
When that time comes, any use of `String#+@` instead of `String#dup` at the application layer will be unnecessary.

Since this is enforced for performance rather than style, I think it makes sense to disable this cop.

This is a suggestion to disable a cop that will eventually become irrelevant, from the perspective of maintaining RuboCop Performance.
I understand that rubocop-rails-omakase does not expect configuration changes, so please feel free to close this if it doesn’t fit.
@koic koic force-pushed the remove_performance_unfreeze_string branch from 1c00ce4 to 89bf744 Compare November 3, 2024 14:29
Copy link
Member

@jeremy jeremy left a comment

Choose a reason for hiding this comment

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

Agreed - thank you

@jeremy jeremy merged commit 8e87a52 into rails:main Nov 3, 2024
@koic koic deleted the remove_performance_unfreeze_string branch November 4, 2024 04:45
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.

2 participants