diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c76eda49..4328812c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ ## master (unreleased) +## 1.22.1 (2024-09-17) + ### Bug fixes * [#468](https://github.com/rubocop/rubocop-performance/issues/468): Fix false positives for `Performance/BigDecimalWithNumericArgument` when using float argument for `BigDecimal`. ([@koic][]) 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 646edec00..6fee4187e 100644 --- a/docs/modules/ROOT/pages/cops_performance.adoc +++ b/docs/modules/ROOT/pages/cops_performance.adoc @@ -96,25 +96,31 @@ NOTE: Required Ruby version: 3.1 | - |=== -Identifies places where string argument to `BigDecimal` should be -converted to numeric. Initializing from Integer is faster -than from String for BigDecimal. +Identifies places where a float argument to BigDecimal should be converted to a string. +Initializing from String is faster than from Float for BigDecimal. + +Also identifies places where an integer string argument to BigDecimal should be converted to +an integer. Initializing from Integer is faster than from String for BigDecimal. === Examples [source,ruby] ---- # bad -BigDecimal('1', 2) -BigDecimal('4', 6) +BigDecimal(1.2, 3, exception: true) +4.5.to_d(6, exception: true) + +# good BigDecimal('1.2', 3, exception: true) BigDecimal('4.5', 6, exception: true) +# bad +BigDecimal('1', 2) +BigDecimal('4', 6) + # good BigDecimal(1, 2) 4.to_d(6) -BigDecimal(1.2, 3, exception: true) -4.5.to_d(6, exception: true) ---- == Performance/BindCall diff --git a/lib/rubocop/performance/version.rb b/lib/rubocop/performance/version.rb index 85afe8938..611ec3d3c 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.22.0' + STRING = '1.22.1' def self.document_version STRING.match('\d+\.\d+').to_s diff --git a/relnotes/v1.22.1.md b/relnotes/v1.22.1.md new file mode 100644 index 000000000..81328a9ea --- /dev/null +++ b/relnotes/v1.22.1.md @@ -0,0 +1,5 @@ +### Bug fixes + +* [#468](https://github.com/rubocop/rubocop-performance/issues/468): Fix false positives for `Performance/BigDecimalWithNumericArgument` when using float argument for `BigDecimal`. ([@koic][]) + +[@koic]: https://github.com/koic