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

[Fix #310] Add EnforcedStyle to Rails/PluckInWhere #317

Merged
merged 1 commit into from
Aug 3, 2020

Conversation

koic
Copy link
Member

@koic koic commented Aug 2, 2020

Fixes #310.

This PR adds EnforcedStyle to Rails/PluckInWhere. By default, it does not register an offense if pluck method's receiver is a variable.


Before submitting the PR make sure the following are checked:

  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the Changelog if the new code introduces user-observable changes. See changelog entry format.
  • If this is a new cop, consider making a corresponding update to the Rails Style Guide.
  • The PR relates to only one subject with a clear title
    and description in grammatically correct, complete sentences.
  • Run bundle exec rake default. It executes all tests and RuboCop for itself, and generates the documentation.

# `ActiveRecord::Relation` instance vs a call to `pluck` on an `Array` instance.
#
# Autocorrect is disabled by default for this cop since it may generate
# false positives.
Copy link
Contributor

Choose a reason for hiding this comment

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

Autocorrect is still enabled by default in this PR, did you mean to disable it too? I think changing the default enforced style to conservative is probably enough.

Copy link
Member Author

Choose a reason for hiding this comment

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

You're quite right! This sentence is a forgotten copy-paste 💦 I update this PR.
Thank you for your review.

Fixes rubocop#310.

This PR adds `EnforcedStyle` to `Rails/PluckInWhere`. By default,
it does not register an offense if `pluck` method's receiver is a variable.
@koic koic force-pushed the add_enforced_style_to_pluck_in_where branch from 285ff91 to 0ddf3b3 Compare August 2, 2020 11:51
@koic koic merged commit ee5c3e0 into rubocop:master Aug 3, 2020
@koic koic deleted the add_enforced_style_to_pluck_in_where branch August 3, 2020 19:17
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.

False Positive for Rails/PluckInWhere
2 participants