Skip to content

Update rubocop-rails to lint deprecated enum keywords#11364

Merged
aduth merged 2 commits intomainfrom
aduth-rubocop-rails-enum-positional
Oct 22, 2024
Merged

Update rubocop-rails to lint deprecated enum keywords#11364
aduth merged 2 commits intomainfrom
aduth-rubocop-rails-enum-positional

Conversation

@aduth
Copy link
Contributor

@aduth aduth commented Oct 18, 2024

🛠 Summary of changes

Updates rubocop-rails to the latest version and addresses identified issues.

In particular, this supports #11357, where Rails 7.2 will now noisily output deprecation messages for enum usage with keyword arguments, slated to be removed in Rails 8 (see rails/rails#50987). Newer versions of rubocop-rails includes a Rails/EnumSyntax cop to help identify these.

📜 Testing Plan

Verify build passes.

Review relevant cops for changes to identify any incompatibilities with "Safety" notes from documentation:

https://docs.rubocop.org/rubocop-rails/cops_rails.html

.rubocop.yml Outdated
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 think we could enable this. It's a bit more of a stylistic one, and the "Safety" notes gave me pause to trust the autocorrecter without closer inspection.

https://docs.rubocop.org/rubocop-rails/cops_rails.html#railswhererange

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, it seems more stylistic and I don't find it significantly better? I could go either way on it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Personally I have trouble recalling whether .. or ... is the inclusive version in a range (i.e. <= or >=), so I'd worry this could also negatively impact readability. Maybe that's just me though 😄

Copy link
Contributor

Choose a reason for hiding this comment

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

I have a slight preference for the explicit >, < as well, so it's not just you 🙂

changelog: Internal, Linting, Update rspec-rails to lint deprecated enum keywords
@aduth aduth force-pushed the aduth-rubocop-rails-enum-positional branch from 4ea1947 to f6aa2a5 Compare October 22, 2024 11:46
Copy link
Contributor Author

Choose a reason for hiding this comment

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

FYSA @jmhooper re: #11350, picked these changes up on a rebase.

@aduth aduth merged commit c1e8556 into main Oct 22, 2024
@aduth aduth deleted the aduth-rubocop-rails-enum-positional branch October 22, 2024 12:34
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