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

[#8489] Exclude method respond_to_missing? from OptionalBooleanParameter cop. #8725

Conversation

em-gazelle
Copy link
Contributor

@em-gazelle em-gazelle commented Sep 16, 2020

This PR stops the OptionalBooleanParameter cop from complaining about code calling Ruby's respond_to_missing?(arg, private = false) method in response to issue 8489.

This is currently non-configurable, but I'm happy to modify it if that'd be useful!


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.

Copy link
Contributor

@marcandre marcandre left a comment

Choose a reason for hiding this comment

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

Good stuff 👍

CHANGELOG.md Outdated
@@ -45,6 +45,7 @@
* [#8500](https://github.com/rubocop-hq/rubocop/issues/8500): Add `in?` to AllowedMethods for `Lint/SafeNavigationChain` cop. ([@tejasbubane][])
* [#8629](https://github.com/rubocop-hq/rubocop/pull/8629): Fix the cache being reusable in CI by using crc32 to calculate file hashes rather than `mtime`, which changes each CI build. ([@dvandersluis][])
* [#8621](https://github.com/rubocop-hq/rubocop/issues/8621): Add helpful Infinite Loop error message. ([@iSarCasm][])
* [#8489](https://github.com/rubocop-hq/rubocop/issues/8489): Exclude method :respond_to_missing? from OptionalBooleanParameter cop. ([@em-gazelle][])
Copy link
Contributor

@marcandre marcandre Sep 16, 2020

Choose a reason for hiding this comment

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

Could you please format this as:

Exclude method `respond_to_missing?` from `Style/OptionalBooleanParameter` cop.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, thank you! Just made the change.

@em-gazelle em-gazelle force-pushed the enhancement/exclude_method_in_optional_bool_parameter_cop branch from da914a1 to 2ef9bcd Compare September 16, 2020 02:15
@em-gazelle em-gazelle force-pushed the enhancement/exclude_method_in_optional_bool_parameter_cop branch from 2ef9bcd to 2f4a16d Compare September 16, 2020 02:20
@mergify mergify bot merged commit 221451e into rubocop:master Sep 16, 2020
@marcandre
Copy link
Contributor

Thank you! 👍

@bbatsov
Copy link
Collaborator

bbatsov commented Sep 16, 2020

Great PR indeed! Down the road it might be good to move this list of excluded methods to the cop configuration, so that users can tweak it, but the suggested solution works fine for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants