-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make
Style/CollectionCompact
aware of delete_if
This PR makes `Style/CollectionCompact` aware of `delete_if`. Note, `Enumerator` does not have `delete_if`, the following use case are allowed: ```ruby % ruby -ve '[1, 2, 3].to_enum.delete_if { |e| e.nil? }' ruby 3.3.0dev (2023-03-17T00:50:41Z master f29c9d6d36) [x86_64-darwin19] -e:1:in `<main>': undefined method `delete_if' for an instance of Enumerator (NoMethodError) [1, 2, 3].to_enum.delete_if { |e| e.nil? } ^^^^^^^^^^ ``` It doesn't register an offense as well as `to_enum` when `lazy` is used.
- Loading branch information
Showing
3 changed files
with
42 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* [#11814](https://github.com/rubocop/rubocop/pull/11814): Make `Style/CollectionCompact` aware of `delete_if`. ([@koic][]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters