Skip to content

Commit 7a5499f

Browse files
committed
[Fix #520] Disable Performance/BigDecimalWithNumericArgument by default
It keeps flip-flopping between versions. Ref: * #468 * #454
1 parent 03a6071 commit 7a5499f

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* [#520](https://github.com/rubocop/rubocop-performance/issues/520): Disable `Performance/BigDecimalWithNumericArgument` by default. ([@earlopain][])

config/default.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ Performance/ArraySemiInfiniteRangeSlice:
2222

2323
Performance/BigDecimalWithNumericArgument:
2424
Description: 'Convert numeric literal to string and pass it to `BigDecimal`.'
25-
Enabled: 'pending'
25+
Enabled: false
2626
VersionAdded: '1.7'
27+
VersionChanged: <<next>>
2728

2829
Performance/BindCall:
2930
Description: 'Use `bind_call(obj, args, ...)` instead of `bind(obj).call(args, ...)`.'

lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ module Performance
99
# Also identifies places where an integer string argument to BigDecimal should be converted to
1010
# an integer. Initializing from Integer is faster than from String for BigDecimal.
1111
#
12+
# NOTE: This cop is disabled by default because the performance of initializing with a String
13+
# and Number differ between versions. Additionally, performance depends on the size of the Number,
14+
# and if it is an Integer or a Float. Since this is very specific to `bigdecimal` internals,
15+
# suggestions from this cop are not unlikely to result in code that performs worse than before.
16+
#
1217
# @example
1318
# # bad
1419
# BigDecimal(1.2, 3, exception: true)

0 commit comments

Comments
 (0)