diff --git a/CHANGELOG.md b/CHANGELOG.md index 099127541..c02460e24 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 cf44ddf5e..da765ab5c 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 21b1815a3..b214d2d88 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 b768b06cf..646edec00 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 6688e4f13..85afe8938 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 000000000..5b540a9b4 --- /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