Skip to content

Commit f36444a

Browse files
author
GitHub Refactor Bot
committed
[Fix #500] Mark Performance/MapCompact cop as unsafe
1 parent 97af229 commit f36444a

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* [#500](https://github.com/rubocop/rubocop-performance/issues/500): Mark `Performance/MapCompact` cop as unsafe. ([@jbpextra][])

config/default.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ Performance/IoReadlines:
194194
Performance/MapCompact:
195195
Description: 'Use `filter_map` instead of `collection.map(&:do_something).compact`.'
196196
Enabled: pending
197-
SafeAutoCorrect: false
197+
Safe: false
198198
VersionAdded: '1.11'
199199

200200
Performance/MapMethodChain:

docs/modules/ROOT/pages/cops_performance.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,7 @@ NOTE: Requires Ruby version 2.7
12501250
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed
12511251
12521252
| Pending
1253-
| Yes
1253+
| No
12541254
| Always (Unsafe)
12551255
| 1.11
12561256
| -
@@ -1269,7 +1269,7 @@ This cop identifies places where `map { ... }.compact` can be replaced by `filte
12691269
[#safety-performancemapcompact]
12701270
=== Safety
12711271
1272-
This cop's autocorrection is unsafe because `map { ... }.compact` might yield
1272+
This cop is unsafe because `map { ... }.compact` might yield
12731273
different results than `filter_map`. As illustrated in the example, `filter_map`
12741274
also filters out falsy values, while `compact` only gets rid of `nil`.
12751275

0 commit comments

Comments
 (0)