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

Mark Lint/InheritException as unsafe auto-correction #10408

Merged
merged 1 commit into from Feb 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/change_mark_lint_inherit_exception_as_unsafe.md
@@ -0,0 +1 @@
* [#10408](https://github.com/rubocop/rubocop/pull/10408): Mark `Lint/InheritException` as unsafe auto-correction. ([@koic][])
2 changes: 2 additions & 0 deletions config/default.yml
Expand Up @@ -1816,7 +1816,9 @@ Lint/IneffectiveAccessModifier:
Lint/InheritException:
Description: 'Avoid inheriting from the `Exception` class.'
Enabled: true
SafeAutoCorrect: false
VersionAdded: '0.41'
VersionChanged: '<<next>>'
# The default base class in favour of `Exception`.
EnforcedStyle: runtime_error
SupportedStyles:
Expand Down
5 changes: 5 additions & 0 deletions lib/rubocop/cop/lint/inherit_exception.rb
Expand Up @@ -8,6 +8,11 @@ module Lint
# `StandardError`. It is configurable to suggest using either
# `RuntimeError` (default) or `StandardError` instead.
#
# @safety
# This cop's autocorrection is unsafe because `rescue` that omit
# exception class handle `StandardError` and its subclasses,
# but not `Exception` and its subclasses.
#
# @example EnforcedStyle: runtime_error (default)
# # bad
#
Expand Down