-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Rails/EnumUniqueness crashes #3918
Comments
Fails also if the STATES = { foo: 0, bar: 1 }
enum state: STATES |
And also if the enums are stored in normal array ROLES = [:boss, :employee].freeze
enum role: ROLES |
I looked into this, and found the reason this cop was so fragile. The node matcher would match any node type passed as a value to the hash, whereas it's only possible for us to inspect (hash- and array) literals. I've submitted a fix for this. 😀 |
Drenmi
added a commit
to Drenmi/rubocop
that referenced
this issue
Jan 16, 2017
…non-literal hash value This cop would break on any enum hash that did not have a literal value. This change fixes that.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
These seem to be related to what #3751 was fixing.
I am getting an error fetching my keys from a method call like so:
Additionally, here's another form using a variable that errors:
Whereas
enum status: %w(one two three)
is fine.RuboCop version
Include the output of
rubocop -V
. Here's an example:The text was updated successfully, but these errors were encountered: