-
-
Notifications
You must be signed in to change notification settings - Fork 263
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 a false positive for Rails/RedundantActiveRecordAllMethod
#1126
Fix a false positive for Rails/RedundantActiveRecordAllMethod
#1126
Conversation
60ccbef
to
343f8fc
Compare
RedundantActiveRecordAllMethod
Rails/RedundantActiveRecordAllMethod
343f8fc
to
c09deca
Compare
May I ask a question? It seems that |
Are there any specific use cases where false negatives are an issue? |
I don't currently have a specific use case in mind, and I just wanted to inquire if this change aligns with my current understanding 😅 |
0db2236
to
93b2574
Compare
@@ -127,12 +127,15 @@ class RedundantActiveRecordAllMethod < Base | |||
without | |||
].to_set.freeze | |||
|
|||
POSSIBLE_ENUMERABLE_BLOCK_METHODS = %i[any? find select].freeze |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like the following methods could also be added to POSSIBLE_ENUMERABLE_BLOCK_METHODS
for the same reason. What do you think?
- none?
- one?
- sum
- count
93b2574
to
049a40e
Compare
Resolves rubocop#1114 (comment) This PR fixes a false positive for `Rails/RedundantActiveRecordAllMethod` when using some `Enumerable`'s methods with block argument. e.g. `Enumerable#find` and `ActiveRecord::Base#find` have different arguments, So false positives can be prevented.
049a40e
to
e586f7f
Compare
Resolves #1114 (comment)
This PR fixes a false positive for
RedundantActiveRecordAllMethod
when usingfind
with block argument.e.g.
Enumerable#find
andActiveRecord::Base#find
have different arguments, So false positives can be prevented.Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).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.