Skip to content

Commit

Permalink
Cut 1.24.0
Browse files Browse the repository at this point in the history
  • Loading branch information
koic committed Feb 15, 2025
1 parent 20c07a2 commit 24a3a4e
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

## master (unreleased)

## 1.24.0 (2025-02-16)

### New features

* [#490](https://github.com/rubocop/rubocop-performance/pull/490): Pluginfy RuboCop Performance. ([@koic][])
Expand Down
2 changes: 1 addition & 1 deletion config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -386,4 +386,4 @@ Performance/ZipWithoutBlock:
Description: 'Checks for `map { |id| [id] }` and suggests replacing it with `zip`.'
Enabled: pending
Safe: false
VersionAdded: <<next>>
VersionAdded: '1.24'
2 changes: 1 addition & 1 deletion docs/antora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ name: rubocop-performance
title: RuboCop Performance
# We always provide version without patch here (e.g. 1.1),
# as patch versions should not appear in the docs.
version: ~
version: '1.24'
nav:
- modules/ROOT/nav.adoc
1 change: 1 addition & 0 deletions docs/modules/ROOT/pages/cops.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,6 @@ Performance cops optimization analysis for your projects.
* xref:cops_performance.adoc#performancetimesmap[Performance/TimesMap]
* xref:cops_performance.adoc#performanceunfreezestring[Performance/UnfreezeString]
* xref:cops_performance.adoc#performanceuridefaultparser[Performance/UriDefaultParser]
* xref:cops_performance.adoc#performancezipwithoutblock[Performance/ZipWithoutBlock]

// END_COP_LIST
35 changes: 35 additions & 0 deletions docs/modules/ROOT/pages/cops_performance.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2598,3 +2598,38 @@ URI::Parser.new
# good
URI::DEFAULT_PARSER
----
[#performancezipwithoutblock]
== Performance/ZipWithoutBlock
|===
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed
| Pending
| No
| Always (Unsafe)
| 1.24
| -
|===
Checks for `map { |id| [id] }` and suggests replacing it with `zip`.
[#safety-performancezipwithoutblock]
=== Safety
This cop is unsafe for novel definitions of `map` and `collect`
on non-Enumerable objects that do not respond to `zip`.
To make your object enumerable, define an `each` method
as described in https://ruby-doc.org/core/Enumerable.html
[#examples-performancezipwithoutblock]
=== Examples
[source,ruby]
----
# bad
[1, 2, 3].map { |id| [id] }
# good
[1, 2, 3].zip
----
2 changes: 1 addition & 1 deletion lib/rubocop/performance/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module RuboCop
module Performance
# This module holds the RuboCop Performance version information.
module Version
STRING = '1.23.1'
STRING = '1.24.0'

def self.document_version
STRING.match('\d+\.\d+').to_s
Expand Down
12 changes: 12 additions & 0 deletions relnotes/v1.24.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
### New features

* [#490](https://github.com/rubocop/rubocop-performance/pull/490): Pluginfy RuboCop Performance. ([@koic][])
* [#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][])

### Bug fixes

* [#484](https://github.com/rubocop/rubocop-performance/pull/484): Fix `Performance/CaseWhenSplat` cop error on `when` node without body. ([@viralpraxis][])

[@koic]: https://github.com/koic
[@corsonknowles]: https://github.com/corsonknowles
[@viralpraxis]: https://github.com/viralpraxis

0 comments on commit 24a3a4e

Please sign in to comment.