Open Darhazer opened 3 years ago
Whether this should be supported by FindEach or a new cop, I have no opinion.
The existing Rails/FindEach
cop is focused on performance. On the other hand, I think the issue is focused on lint or style. So I think it's better to have a different cop than Rails/FindEach
cop.
Is your feature request related to a problem? Please describe.
I've seen code like
This could be safely replaced by
find_each
. Note - the .each at the end doesn't make a difference, it could be justfind_in_batches do
. As long as find_in_batches has no options, and the iteration is the only thing in the block, it could be find_each instead.Describe the solution you'd like
Whether this should be supported by FindEach or a new cop, I have no opinion.
Describe alternatives you've considered
I guess this could be easily added to the existing FindEach cop, though it would add to the complexity of the otherwise quite simple cop.