-
-
Notifications
You must be signed in to change notification settings - Fork 285
Closed
Description
The cop Rails/EnumSyntax works for a file placed in the app/ folder, but not for one in the lib/ folder.
Expected behavior
Given this configuration
# .rubocop.yml
plugins:
- rubocop-rails
Rails/EnumSyntax:
Enabled: true
Severity: error
I expect that the following code yields an offense
# lib/enum_lib.rb
class EnumerableInLib # rubocop:disable Style/Documentation,Style/FrozenStringLiteralComment
enum status: { active: 0, archived: 1 }
endThe auto-corrected code should read:
# lib/enum_lib.rb
class EnumerableInLib # rubocop:disable Style/Documentation,Style/FrozenStringLiteralComment
enum :status, { active: 0, archived: 1 }
endActual behavior
If the Ruby file is placed inside the app/ folder, the violation is detected, however not if placed in the lib/ folder.
Steps to reproduce the problem
See my reproduction and its Readme.
RuboCop version
1.75.4 (using Parser 3.3.8.0, Prism 1.4.0, rubocop-ast 1.44.1, analyzing as Ruby 3.3, running on ruby 3.3.8) [x86_64-linux]
- rubocop-rails 2.31.0
Metadata
Metadata
Assignees
Labels
No labels