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 EnforcedStyle to standard_error for Lint/InheritException #10407

Merged
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
@@ -0,0 +1 @@
* [#10407](https://github.com/rubocop/rubocop/pull/10407): Change `EnforcedStyle` from `runtime_error` to `standard_error` for `Lint/InheritException`. ([@koic][])
4 changes: 2 additions & 2 deletions config/default.yml
Expand Up @@ -1820,10 +1820,10 @@ Lint/InheritException:
VersionAdded: '0.41'
VersionChanged: '<<next>>'
# The default base class in favour of `Exception`.
EnforcedStyle: runtime_error
EnforcedStyle: standard_error
SupportedStyles:
- runtime_error
- standard_error
- runtime_error

Lint/InterpolationCheck:
Description: 'Raise warning for interpolation in single q strs.'
Expand Down
14 changes: 7 additions & 7 deletions lib/rubocop/cop/lint/inherit_exception.rb
Expand Up @@ -6,14 +6,14 @@ module Lint
# This cop looks for error classes inheriting from `Exception`
# and its standard library subclasses, excluding subclasses of
# `StandardError`. It is configurable to suggest using either
# `RuntimeError` (default) or `StandardError` instead.
# `StandardError` (default) or `RuntimeError` 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)
# @example EnforcedStyle: standard_error (default)
# # bad
#
# class C < Exception; end
Expand All @@ -22,11 +22,11 @@ module Lint
#
# # good
#
# class C < RuntimeError; end
# class C < StandardError; end
#
# C = Class.new(RuntimeError)
# C = Class.new(StandardError)
#
# @example EnforcedStyle: standard_error
# @example EnforcedStyle: runtime_error
# # bad
#
# class C < Exception; end
Expand All @@ -35,9 +35,9 @@ module Lint
#
# # good
#
# class C < StandardError; end
# class C < RuntimeError; end
#
# C = Class.new(StandardError)
# C = Class.new(RuntimeError)
class InheritException < Base
include ConfigurableEnforcedStyle
extend AutoCorrector
Expand Down