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 Style/RaiseArgs as unsafe #12637

Merged
merged 1 commit into from
Jan 24, 2024
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_style_raise_args_as_unsafe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* [#12637](https://github.com/rubocop/rubocop/pull/12637): Mark `Style/RaiseArgs` as unsafe. ([@r7kamura][])
3 changes: 2 additions & 1 deletion config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4835,8 +4835,9 @@ Style/RaiseArgs:
Description: 'Checks the arguments passed to raise/fail.'
StyleGuide: '#exception-class-messages'
Enabled: true
Safe: false
VersionAdded: '0.14'
VersionChanged: '1.2'
VersionChanged: '<<next>>'
EnforcedStyle: exploded
SupportedStyles:
- compact # raise Exception.new(msg)
Expand Down
3 changes: 3 additions & 0 deletions lib/rubocop/cop/style/raise_args.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ module Style
# The exploded style has an `AllowedCompactTypes` configuration
# option that takes an Array of exception name Strings.
#
# @safety
# This cop is unsafe because `raise Foo` calls `Foo.exception`, not `Foo.new`.
#
# @example EnforcedStyle: exploded (default)
# # bad
# raise StandardError.new('message')
Expand Down