Skip to content
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

Add scope methods to Rails/FindEach cop #6161

Merged
merged 1 commit into from Aug 7, 2018

Conversation

repinel
Copy link
Contributor

@repinel repinel commented Aug 6, 2018

Makes the cop check for the following scopes: includes, joins, left_outer_joins, and unscoped.

I can add a changelog entry if this looks good.

@@ -15,7 +15,9 @@ module Rails
class FindEach < Cop
MSG = 'Use `find_each` instead of `each`.'.freeze

SCOPE_METHODS = %i[all where not].freeze
SCOPE_METHODS = %i[
all includes joins left_outer_joins not unscoped where
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If includes, joins and left_outer_joins were added, I thought that we could also add eager_load, left_joins, preload and references.

And this will also change the behavior, so it should be written in the Changes section of CHANGELOG 😃
https://github.com/rubocop-hq/rubocop/blob/63cdaa28a32a7ab475d61666564af468e61078e3/CHANGELOG.md#changes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me. I'll update the PR. Thanks

Makes the cop also check for the following scopes: `eager_load`,
`includes`, `joins`, `left_joins`, `left_outer_joins`, `preload`,
`references`, and `unscoped`.
@repinel
Copy link
Contributor Author

repinel commented Aug 7, 2018

@koic should be good now

@koic koic merged commit 884f5fc into rubocop:master Aug 7, 2018
@koic
Copy link
Member

koic commented Aug 7, 2018

Thank you!

@repinel repinel deleted the improve-rails-find-each branch August 7, 2018 20:05
koic added a commit to koic/rubocop-rails that referenced this pull request Aug 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants