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 option to allow case equality when the receiver is a constant #7861

Merged

Conversation

rafaelfranca
Copy link
Contributor

@rafaelfranca rafaelfranca commented Apr 9, 2020

For some constant, specially direct subclasses of BasicObject, using is_a? is not an option since BasicObject doesn't respond to that method.

In those cases it would be interesting to allow this config so apps can opt-out that cop only when the receiver is a constant.


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.
  • 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.

@rafaelfranca rafaelfranca force-pushed the rm-allow-constant-receiver-case-equality branch 3 times, most recently from bf2204a to ebbe68c Compare April 9, 2020 20:07
For some constant, specially direct subclasses of `BasicObject`, using
`is_a?` is not an option since `BasicObject` doesn't respond to that
method.

In those cases it would be interesting to allow this config so apps can
opt-out that cop only when the receiver is a constant.
@rafaelfranca rafaelfranca force-pushed the rm-allow-constant-receiver-case-equality branch from ebbe68c to c48064f Compare April 9, 2020 20:15
@bbatsov bbatsov merged commit ae73ae7 into rubocop:master Apr 10, 2020
@bbatsov
Copy link
Collaborator

bbatsov commented Apr 10, 2020

I like the suggested change. Thanks! 🙇‍♂️

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