Skip to content

Commit 1a7fa7c

Browse files
committed
Cut 1.25.0
1 parent 9bbcc52 commit 1a7fa7c

File tree

5 files changed

+31
-4
lines changed

5 files changed

+31
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
## master (unreleased)
1313

14+
## 1.25.0 (2025-04-01)
15+
1416
### New features
1517

1618
* [#496](https://github.com/rubocop/rubocop-performance/pull/496): Support `it` block parameter in `Performance` cops. ([@koic][])

docs/antora.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ name: rubocop-performance
22
title: RuboCop Performance
33
# We always provide version without patch here (e.g. 1.1),
44
# as patch versions should not appear in the docs.
5-
version: ~
5+
version: '1.25'
66
nav:
77
- modules/ROOT/nav.adoc

docs/modules/ROOT/pages/cops_performance.adoc

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,14 @@ to avoid unnecessary allocations on each iteration.
425425
You can set the minimum number of elements to consider
426426
an offense with `MinSize`.
427427
428+
NOTE: Since Ruby 3.4, certain simple arguments to `Array#include?` are
429+
optimized directly in Ruby. This avoids allocations without changing the
430+
code, as such no offense will be registered in those cases. Currently that
431+
includes: strings, `self`, local variables, instance variables, and method
432+
calls without arguments. Additionally, any number of methods can be chained:
433+
`[1, 2, 3].include?(@foo)` and `[1, 2, 3].include?(@foo.bar.baz)` both avoid
434+
the array allocation.
435+
428436
[#examples-performancecollectionliteralinloop]
429437
=== Examples
430438
@@ -2281,18 +2289,19 @@ and the following examples are parts of it.
22812289
send('do_something')
22822290
attr_accessor 'do_something'
22832291
instance_variable_get('@ivar')
2284-
respond_to?("string_#{interpolation}")
22852292
22862293
# good
22872294
send(:do_something)
22882295
attr_accessor :do_something
22892296
instance_variable_get(:@ivar)
2290-
respond_to?(:"string_#{interpolation}")
22912297
22922298
# good - these methods don't support namespaced symbols
22932299
const_get("#{module_path}::Base")
22942300
const_source_location("#{module_path}::Base")
22952301
const_defined?("#{module_path}::Base")
2302+
2303+
# good - using a symbol when string interpolation is involved causes a performance regression.
2304+
respond_to?("string_#{interpolation}")
22962305
----
22972306
22982307
[#performancestringinclude]

lib/rubocop/performance/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module RuboCop
44
module Performance
55
# This module holds the RuboCop Performance version information.
66
module Version
7-
STRING = '1.24.0'
7+
STRING = '1.25.0'
88

99
def self.document_version
1010
STRING.match('\d+\.\d+').to_s

relnotes/v1.25.0.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
### New features
2+
3+
* [#496](https://github.com/rubocop/rubocop-performance/pull/496): Support `it` block parameter in `Performance` cops. ([@koic][])
4+
5+
### Bug fixes
6+
7+
* [#494](https://github.com/rubocop/rubocop-performance/pull/494): Fix `Performance/FixedSize` false positive when `count` is called with a `numblock`. ([@dvandersluis][])
8+
* [#492](https://github.com/rubocop/rubocop-performance/issues/492): Fix false positives for `Performance/StringIdentifierArgument` when using interpolated string argument. ([@koic][])
9+
10+
### Changes
11+
12+
* [#482](https://github.com/rubocop/rubocop-performance/issues/482): Change `Performance/CollectionLiteralInLoop` to not register offenses for `Array#include?` that are optimized directly in Ruby. ([@earlopain][])
13+
14+
[@koic]: https://github.com/koic
15+
[@dvandersluis]: https://github.com/dvandersluis
16+
[@earlopain]: https://github.com/earlopain

0 commit comments

Comments
 (0)