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

Fix a false positive for Style/RedundantSelfAssignment when calling coercion methods #8658

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.md
Expand Up @@ -10,6 +10,7 @@
### Bug fixes

* [#8627](https://github.com/rubocop-hq/rubocop/issues/8627): Fix a false positive for `Lint/DuplicateRequire` when same feature argument but different require method. ([@koic][])
* [#8658](https://github.com/rubocop-hq/rubocop/pull/8658): Fix a false positive for `Style/RedundantSelfAssignment` when calling coercion methods. ([@fatkodima][])
* [#8607](https://github.com/rubocop-hq/rubocop/issues/8607): Fix a false positive for `Lint/UnreachableLoop` when conditional branch includes continue statement preceding break statement. ([@fatkodima][])
* [#8572](https://github.com/rubocop-hq/rubocop/issues/8572): Fix a false positive for `Style/RedundantParentheses` when parentheses are used like method argument parentheses. ([@koic][])
* [#8653](https://github.com/rubocop-hq/rubocop/pull/8653): Fix a false positive for `Layout/DefEndAlignment` when using refinements and `private def`. ([@koic][])
Expand Down
4 changes: 2 additions & 2 deletions lib/rubocop/cop/style/redundant_self_assignment.rb
Expand Up @@ -37,8 +37,8 @@ class RedundantSelfAssignment < Base
METHODS_RETURNING_SELF = %i[
append clear collect! compare_by_identity concat delete_if
fill initialize_copy insert keep_if map! merge! prepend push
rehash replace reverse! rotate! shuffle! sort! sort_by! to_ary
to_hash transform_keys! transform_values! unshift update
rehash replace reverse! rotate! shuffle! sort! sort_by!
transform_keys! transform_values! unshift update
].to_set.freeze

ASSIGNMENT_TYPE_TO_RECEIVER_TYPE = {
Expand Down