Skip to content

Commit

Permalink
Mark Style/RaiseArgs as unsafe
Browse files Browse the repository at this point in the history
  • Loading branch information
r7kamura authored and bbatsov committed Jan 24, 2024
1 parent edb56c9 commit fbf41c6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
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

0 comments on commit fbf41c6

Please sign in to comment.