rubocop / rubocop-rails

A RuboCop extension focused on enforcing Rails best practices and coding conventions.
https://docs.rubocop.org/rubocop-rails
MIT License
822 stars 263 forks source link

Fix `Rails/CompactBlank` to avoid reporting offense for `filter` in Ruby versions below 2.6 #1361

Closed masato-bkn closed 2 months ago

masato-bkn commented 2 months ago

This PR fixes Rails/CompactBlank to avoid reporting offense for filter in Ruby versions below 2.6.

This change is related to https://github.com/rubocop/rubocop-rails/pull/1359. Apologies for the confusion earlier, as I initially mixed up the runtime version with the analysis version when considering Rubocop's supported versions.

Rails/CompactBlank applies to Rails 6.1 and above, where the required Ruby version is 2.5. However, since filter method was introduced in Ruby 2.6, using filter in environments running Ruby 2.5 may result in false positives.

Additionally, since https://github.com/rubocop/rubocop-rails/pull/1359 is still unreleased, I am unsure whether this change should be added to the changelog. I would appreciate any feedback, including thoughts on other aspects of this PR.


Before submitting the PR make sure the following are checked:

koic commented 2 months ago

Thank you for following up!