-
-
Notifications
You must be signed in to change notification settings - Fork 83
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 #336] Expand the safety warning on Performance/Detect #337
Conversation
In addition to the external library activerecord, the built in Hash class also has compatibility issues.
Yeah, this change does not require a changelog entry and tests. Thank you for the improvement! |
I understand that this cop's autocorrection can fail depending on the receiver. However, I think that the autocorrection will succeed correctly both when the receiver is a |
In the original issue I added an example: #336. |
@ekohl I had missed it, thanks! So the description says:
but the actual reason of the unsafety is that there is no |
I think you're right that it could be phrased better. Should this be considered sufficient:
Then drop this part with specific method names?
So it becomes:
|
hmm, since this cop depends on
On another point, I feel it would be better to remove the explanation about ActiveRecord. Because in fact |
Archeology time! ActiveRecord 5 started to include So I think you're right that the unsafe part is limited to |
In addition to the external library activerecord, the built in Hash class also has compatibility issues.
I'm unsure if this deserves a changelog entry, given it doesn't change the code there shouldn't be an impact (which is why I didn't add tests either).
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).Added tests.bundle exec rake default
. It executes all tests and runs RuboCop on its own code.{change_type}_{change_description}.md
if the new code introduces user-observable changes. See changelog entry format for details.