Skip to content

Commit

Permalink
Mark Performance/RedundantMerge as unsafe.
Browse files Browse the repository at this point in the history
  • Loading branch information
dvandersluis committed Mar 29, 2021
1 parent e2c58d8 commit 26c3a6e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## master (unreleased)

### Changes

* [#228](https://github.com/rubocop/rubocop-performance/pull/228): Mark `Performance/RedundantMerge` as unsafe. ([@dvandersluis][])

## 1.10.2 (2021-03-23)

### Bug fixes
Expand Down
2 changes: 2 additions & 0 deletions config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ Performance/RedundantMerge:
Description: 'Use Hash#[]=, rather than Hash#merge! with a single key-value pair.'
Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashmerge-vs-hash-code'
Enabled: true
Safe: false
VersionAdded: '0.36'
VersionChanged: '1.11'
# Max number of key-value pairs to consider an offense
MaxKeyValuePairs: 2

Expand Down
3 changes: 3 additions & 0 deletions lib/rubocop/cop/performance/redundant_merge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ module Performance
# You can set the maximum number of key-value pairs to consider
# an offense with `MaxKeyValuePairs`.
#
# This cop is marked as unsafe because RuboCop cannot determine if the
# receiver of `merge!` is actually a hash or not.
#
# @example
# # bad
# hash.merge!(a: 1)
Expand Down

0 comments on commit 26c3a6e

Please sign in to comment.