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

[Fix #1362] Fix false positives for Rails/EnumSyntax #1363

Merged
merged 1 commit into from
Sep 12, 2024

Conversation

koic
Copy link
Member

@koic koic commented Sep 12, 2024

Fixes #1362.

This PR fixes false positives for Rails/EnumSyntax when using Ruby 2.7.

The warning shown in #1238 appears starting from Rails 7.2 (Requires Ruby 3.1+). On the other hand, if users use Ruby 2.7, the warning reported in #1362 will be displayed.

Therefore, it would be appropriate to enable this cop only when analyzing Ruby 3.0+.

Nothing will happen when using Ruby 2.7 with Rails 7.0 or Rails 7.1, but the warning in #1238 will not be displayed either. Meanwhile, in Rails 7.2, which requires Ruby 3.1+, Ruby 2.7 cannot be used, so there is no issue.


Before submitting the PR make sure the following are checked:

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Ran bundle exec rake default. It executes all tests and runs RuboCop on its own code.
  • Added an entry (file) to the changelog folder named {change_type}_{change_description}.md if the new code introduces user-observable changes. See changelog entry format for details.
  • If this is a new cop, consider making a corresponding update to the Rails Style Guide.

Fixes rubocop#1362.

This PR fixes false positives for `Rails/EnumSyntax` when using Ruby 2.7.

The warning shown in rubocop#1238 appears starting from Rails 7.2 (Requires Ruby 3.1+).
On the other hand, if users use Ruby 2.7, the warning reported in rubocop#1362 will be displayed.

Therefore, it would be appropriate to enable this cop only when analyzing Ruby 3.0+.

Nothing will happen when using Ruby 2.7 with Rails 7.0 or Rails 7.1, but the warning in rubocop#1238
will not be displayed either. Meanwhile, in Rails 7.2, which requires Ruby 3.1+, Ruby 2.7 cannot be used, so there is no issue.
@koic koic force-pushed the fix_false_positives_for_rails_enum_syntax branch from 490b0fb to 50fe9a7 Compare September 12, 2024 03:40
@koic koic merged commit 5dc42d5 into rubocop:master Sep 12, 2024
14 checks passed
@koic koic deleted the fix_false_positives_for_rails_enum_syntax branch September 12, 2024 16:55
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.

Rails/EnumSyntax autocorrection causes deprecation warning on Ruby 2.7
1 participant