Skip to content

Commit

Permalink
Make Style/CollectionMethods aware of collect_concat
Browse files Browse the repository at this point in the history
This PR makes `Style/CollectionMethods` aware of `collect_concat`
because matches the existing `map` and `collect` terminology selection.
  • Loading branch information
koic authored and bbatsov committed Sep 11, 2023
1 parent 3dda01c commit 70fd319
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* [#12197](https://github.com/rubocop/rubocop/pull/12197): Make `Style/CollectionMethods` aware of `collect_concat`. ([@koic][])
1 change: 1 addition & 0 deletions config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3409,6 +3409,7 @@ Style/CollectionMethods:
PreferredMethods:
collect: 'map'
collect!: 'map!'
collect_concat: 'flat_map'
inject: 'reduce'
detect: 'find'
find_all: 'select'
Expand Down
2 changes: 2 additions & 0 deletions lib/rubocop/cop/style/collection_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ module Style
# # bad
# items.collect
# items.collect!
# items.collect_concat
# items.inject
# items.detect
# items.find_all
Expand All @@ -33,6 +34,7 @@ module Style
# # good
# items.map
# items.map!
# items.flat_map
# items.reduce
# items.find
# items.select
Expand Down

0 comments on commit 70fd319

Please sign in to comment.