From bf5f64f33a3cfbd369a9245e087aa25ee6bbf983 Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Mon, 16 Sep 2024 17:15:43 +0900 Subject: [PATCH] Cut 1.22.0 --- CHANGELOG.md | 2 ++ config/default.yml | 2 +- docs/antora.yml | 2 +- docs/modules/ROOT/pages/cops_performance.adoc | 27 +++++++++++-------- lib/rubocop/performance/version.rb | 2 +- relnotes/v1.22.0.md | 11 ++++++++ 6 files changed, 32 insertions(+), 14 deletions(-) create mode 100644 relnotes/v1.22.0.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 0991275410..c02460e24e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ ## master (unreleased) +## 1.22.0 (2024-09-16) + ### Bug fixes * [#454](https://github.com/rubocop/rubocop-performance/issues/454): Fix false positives for `Performance/BigDecimalWithNumericArgument` when using BigDecimal 3.1+. ([@koic][]) diff --git a/config/default.yml b/config/default.yml index cf44ddf5ed..da765ab5c4 100644 --- a/config/default.yml +++ b/config/default.yml @@ -36,7 +36,7 @@ Performance/BlockGivenWithExplicitBlock: # https://github.com/rubocop/rubocop-performance/issues/385 Enabled: false VersionAdded: '1.9' - VersionChanged: <> + VersionChanged: '1.22' Performance/Caller: Description: >- diff --git a/docs/antora.yml b/docs/antora.yml index 21b1815a34..b214d2d88b 100644 --- a/docs/antora.yml +++ b/docs/antora.yml @@ -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.22' nav: - modules/ROOT/nav.adoc diff --git a/docs/modules/ROOT/pages/cops_performance.adoc b/docs/modules/ROOT/pages/cops_performance.adoc index b768b06cfe..646edec001 100644 --- a/docs/modules/ROOT/pages/cops_performance.adoc +++ b/docs/modules/ROOT/pages/cops_performance.adoc @@ -84,6 +84,8 @@ array.take(3) == Performance/BigDecimalWithNumericArgument +NOTE: Required Ruby version: 3.1 + |=== | Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed @@ -94,25 +96,25 @@ array.take(3) | - |=== -Identifies places where numeric argument to BigDecimal should be -converted to string. Initializing from String is faster -than from Numeric for BigDecimal. +Identifies places where string argument to `BigDecimal` should be +converted to numeric. Initializing from Integer is faster +than from String for BigDecimal. === Examples [source,ruby] ---- # bad -BigDecimal(1, 2) -4.to_d(6) -BigDecimal(1.2, 3, exception: true) -4.5.to_d(6, exception: true) - -# good BigDecimal('1', 2) BigDecimal('4', 6) BigDecimal('1.2', 3, exception: true) BigDecimal('4.5', 6, exception: true) + +# good +BigDecimal(1, 2) +4.to_d(6) +BigDecimal(1.2, 3, exception: true) +4.5.to_d(6, exception: true) ---- == Performance/BindCall @@ -154,16 +156,19 @@ umethod.bind_call(obj, foo, bar) |=== | Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed -| Pending +| Disabled | Yes | Always | 1.9 -| - +| 1.22 |=== Identifies unnecessary use of a `block_given?` where explicit check of block argument would suffice. +NOTE: This cop produces code with significantly worse performance when a +block is being passed to the method and as such should not be enabled. + === Examples [source,ruby] diff --git a/lib/rubocop/performance/version.rb b/lib/rubocop/performance/version.rb index 6688e4f130..85afe89381 100644 --- a/lib/rubocop/performance/version.rb +++ b/lib/rubocop/performance/version.rb @@ -4,7 +4,7 @@ module RuboCop module Performance # This module holds the RuboCop Performance version information. module Version - STRING = '1.21.1' + STRING = '1.22.0' def self.document_version STRING.match('\d+\.\d+').to_s diff --git a/relnotes/v1.22.0.md b/relnotes/v1.22.0.md new file mode 100644 index 0000000000..5b540a9b4f --- /dev/null +++ b/relnotes/v1.22.0.md @@ -0,0 +1,11 @@ +### Bug fixes + +* [#454](https://github.com/rubocop/rubocop-performance/issues/454): Fix false positives for `Performance/BigDecimalWithNumericArgument` when using BigDecimal 3.1+. ([@koic][]) + +### Changes + +* [#385](https://github.com/rubocop/rubocop-performance/issues/385): Disable `Performance/BlockGivenWithExplicitBlock` by default. ([@earlopain][]) +* [#407](https://github.com/rubocop/rubocop-performance/issues/407): Make `Performance/DoubleStartEndWith` aware of safe navigation. ([@earlopain][]) + +[@koic]: https://github.com/koic +[@earlopain]: https://github.com/earlopain