File tree 7 files changed +53
-3
lines changed
7 files changed +53
-3
lines changed Original file line number Diff line number Diff line change 11
11
12
12
## master (unreleased)
13
13
14
+ ## 1.24.0 (2025-02-16)
15
+
14
16
### New features
15
17
16
18
* [ #490 ] ( https://github.com/rubocop/rubocop-performance/pull/490 ) : Pluginfy RuboCop Performance. ([ @koic ] [ ] )
Original file line number Diff line number Diff line change @@ -386,4 +386,4 @@ Performance/ZipWithoutBlock:
386
386
Description : ' Checks for `map { |id| [id] }` and suggests replacing it with `zip`.'
387
387
Enabled : pending
388
388
Safe : false
389
- VersionAdded : <<next>>
389
+ VersionAdded : ' 1.24 '
Original file line number Diff line number Diff line change @@ -2,6 +2,6 @@ name: rubocop-performance
2
2
title : RuboCop Performance
3
3
# We always provide version without patch here (e.g. 1.1),
4
4
# as patch versions should not appear in the docs.
5
- version : ~
5
+ version : ' 1.24 '
6
6
nav :
7
7
- modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change @@ -63,5 +63,6 @@ Performance cops optimization analysis for your projects.
63
63
* xref:cops_performance.adoc#performancetimesmap[Performance/TimesMap]
64
64
* xref:cops_performance.adoc#performanceunfreezestring[Performance/UnfreezeString]
65
65
* xref:cops_performance.adoc#performanceuridefaultparser[Performance/UriDefaultParser]
66
+ * xref:cops_performance.adoc#performancezipwithoutblock[Performance/ZipWithoutBlock]
66
67
67
68
// END_COP_LIST
Original file line number Diff line number Diff line change @@ -2598,3 +2598,38 @@ URI::Parser.new
2598
2598
# good
2599
2599
URI::DEFAULT_PARSER
2600
2600
----
2601
+
2602
+ [#performancezipwithoutblock]
2603
+ == Performance/ZipWithoutBlock
2604
+
2605
+ |===
2606
+ | Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed
2607
+
2608
+ | Pending
2609
+ | No
2610
+ | Always (Unsafe)
2611
+ | 1.24
2612
+ | -
2613
+ |===
2614
+
2615
+ Checks for `map { |id| [id] }` and suggests replacing it with `zip`.
2616
+
2617
+ [#safety-performancezipwithoutblock]
2618
+ === Safety
2619
+
2620
+ This cop is unsafe for novel definitions of `map` and `collect`
2621
+ on non-Enumerable objects that do not respond to `zip`.
2622
+ To make your object enumerable, define an `each` method
2623
+ as described in https://ruby-doc.org/core/Enumerable.html
2624
+
2625
+ [#examples-performancezipwithoutblock]
2626
+ === Examples
2627
+
2628
+ [source,ruby]
2629
+ ----
2630
+ # bad
2631
+ [1, 2, 3].map { |id| [id] }
2632
+
2633
+ # good
2634
+ [1, 2, 3].zip
2635
+ ----
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ module RuboCop
4
4
module Performance
5
5
# This module holds the RuboCop Performance version information.
6
6
module Version
7
- STRING = '1.23.1 '
7
+ STRING = '1.24.0 '
8
8
9
9
def self . document_version
10
10
STRING . match ( '\d+\.\d+' ) . to_s
Original file line number Diff line number Diff line change
1
+ ### New features
2
+
3
+ * [ #490 ] ( https://github.com/rubocop/rubocop-performance/pull/490 ) : Pluginfy RuboCop Performance. ([ @koic ] [ ] )
4
+ * [ #462 ] ( https://github.com/rubocop/rubocop-performance/pull/462 ) : Add new ` Performance/ZipWithoutBlock ` cop that checks patterns like ` .map { |id| [id] } ` or ` .map { [_1] } ` and can replace them with ` .zip ` . ([ @corsonknowles ] [ ] )
5
+
6
+ ### Bug fixes
7
+
8
+ * [ #484 ] ( https://github.com/rubocop/rubocop-performance/pull/484 ) : Fix ` Performance/CaseWhenSplat ` cop error on ` when ` node without body. ([ @viralpraxis ] [ ] )
9
+
10
+ [ @koic ] : https://github.com/koic
11
+ [ @corsonknowles ] : https://github.com/corsonknowles
12
+ [ @viralpraxis ] : https://github.com/viralpraxis
You can’t perform that action at this time.
0 commit comments