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
Style/ArrayCoercion does not play nicely with Hashes #8783
Comments
The main reason I didn't rush into a decision is that the cop has been around for a while and there are relatively few complaints which leads me to believe it's useful in most cases. If only Ruby's internals were more consistent. 😆 I'm leaning towards simply disabling the cop, so that people can still run it on demand when needed, but some thoughts from others in @rubocop-hq/rubocop-core are welcome. |
I agree to disable the cop by default. Because users who want to detect the style guide rule in exchange for false positives may want to enable it. |
Fixes rubocop#8783, rubocop#8391, and rubocop#8334. This PR disables `Style/ArrayCoercion` cop by default. Because false positive will occur if the argument of `Array()` is not an array (e.g. Hash, Set), an array will be returned as an incompatibility result.
Expected behaviour
The Style/ArrayCoercion is not safe because it converts hashes to arrays.
Actual behaviour
Which leads to values being:
RuboCop version
The text was updated successfully, but these errors were encountered: