rubocop / rubocop-performance

An extension of RuboCop focused on code performance checks.
https://docs.rubocop.org/rubocop-performance
MIT License
687 stars 81 forks source link

[Fix #454] Fix false positives for `Performance/BigDecimalWithNumericArgument` #463

Closed koic closed 2 months ago

koic commented 2 months ago

Fixes #454.

This PR fixes false positives for Performance/BigDecimalWithNumericArgument when using BigDecimal 3.1+.

The bad and good examples for this cop are reversed between BigDecimal 3.0 and 3.1.

Since BigDecimal 3.1 is the default gem in Ruby 3.1, this PR reverses the bad and good examples when targeting Ruby 3.1+. So, the goal of this PR is to address many cases where the meaning was entirely reversed.

To avoid introducing excessive complexity related to version dependencies, detection is disabled for Ruby 3.0 and below.

Ideally, a solution that prioritizes the BigDecimal version would be best in the future, but this PR does not take that into account.


Before submitting the PR make sure the following are checked: