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

Change AllowComments of Lint/SuppressedException to true by default #7805

Merged

Conversation

koic
Copy link
Member

@koic koic commented Mar 18, 2020

Summary

Follow #7052 (comment).

This PR changes AllowComments option of Lint/SuppressedException to true by default.

As is used in RuboCop repo itself, it is a common practice to use source code comments to explain when exception handling is not performed.

Related Information

I think that Suppressing Exceptions rule can be refined to a suitable example.
https://github.com/rubocop-hq/ruby-style-guide#dont-hide-exceptions


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.

## Summary

Follow rubocop#7052 (comment).

This PR changes `AllowComments` option of `Lint/SuppressedException` to
true by default.

As is used in RuboCop repo itself, it is a common practice to use
source code comments to explain when exception handling is not performed.

## Related Information

I think that `Suppressing Exceptions` rule can be refined to a suitable example.
https://github.com/rubocop-hq/ruby-style-guide#dont-hide-exceptions
@bbatsov bbatsov merged commit 84d6c57 into rubocop:master Mar 19, 2020
@bbatsov
Copy link
Collaborator

bbatsov commented Mar 19, 2020

I think that Suppressing Exceptions rule can be refined to a suitable example.
https://github.com/rubocop-hq/ruby-style-guide#dont-hide-exceptions

Agreed.

@koic koic deleted the allow_comments_of_suppressed_exception_by_default branch March 19, 2020 10:46
koic added a commit to koic/ruby-style-guide that referenced this pull request Mar 20, 2020
Follow up of rubocop/rubocop#7805 (comment).

This PR refines an example for "Suppressing Exceptions" rule.

And `do_something rescue nil` will be changed from bad case to good case
based on RuboCop (0.81)'s behavior and the comment below.
rubocop/rubocop#7297 (comment)
bbatsov pushed a commit to rubocop/ruby-style-guide that referenced this pull request Mar 20, 2020
Follow up of rubocop/rubocop#7805 (comment).

This PR refines an example for "Suppressing Exceptions" rule.

And `do_something rescue nil` will be changed from bad case to good case
based on RuboCop (0.81)'s behavior and the comment below.
rubocop/rubocop#7297 (comment)
koic added a commit to koic/rubocop that referenced this pull request May 10, 2020
Fixes rubocop#3696 and rubocop#3754.

This PR add `AllowComments` option to `Lint/EmptyWhen` cop.
This option is enabled by default based on user feedback.
It is also the same default as the option of `Lint/SuppressedException`
set in rubocop#7805.
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