Skip to content

Commit

Permalink
Mark Style/HashExcept as unsafe
Browse files Browse the repository at this point in the history
  • Loading branch information
r7kamura committed Nov 8, 2022
1 parent cb29d08 commit 4c5b303
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog/change_mark_style_hash_except_as_unsafe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* [#11163](https://github.com/rubocop/rubocop/pull/11163): Mark `Style/HashExcept` as unsafe. ([@r7kamura][])
3 changes: 2 additions & 1 deletion config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3820,8 +3820,9 @@ Style/HashExcept:
Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
that can be replaced with `Hash#except` method.
Enabled: pending
Safe: false
VersionAdded: '1.7'
VersionChanged: '1.31'
VersionChanged: '<<next>>'

Style/HashLikeCase:
Description: >-
Expand Down
4 changes: 4 additions & 0 deletions lib/rubocop/cop/style/hash_except.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ module Style
# when used `==`.
# And do not check `Hash#delete_if` and `Hash#keep_if` to change receiver object.
#
# @safety
# This cop is unsafe because it cannot be guaranteed that the receiver
# is a `Hash` or responds to the replacement method.
#
# @example
#
# # bad
Expand Down

0 comments on commit 4c5b303

Please sign in to comment.