-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new Lint/BigDecimalNew
cop
#5248
Conversation
ef70133
to
31ec733
Compare
I saw this change at rails/rails#31435. |
BTW, I think we should ship v0.52.1, that is a bug fix release. And the release should not contain any new features. So we need to wait merging this pull-request until we ship the release. |
This looks like it'd be a good check to add to |
Thanks for the review. I have worries. BigDecimal is not a standard library, it is a default gems managed by ruby/bigdecimal repo. % gem list | grep default
bigdecimal (default: 1.3.2)
(snip) I don't know whether it is preferable to change configuration in the same lifecycle as Of course, as a practical use case, I think that there is no need to make an independent configuration change, so adding it to |
I agree. That was my plan as well - do a bugfix release over the weekend or early next week. Unfortunately I'll be super busy until Tuesday. |
a7634a0
to
d02b60b
Compare
Please, rebase on top of the current |
d02b60b
to
17aeedc
Compare
Thanks. I did rebase. |
## Feature `BigDecimal.new()` is deprecated since BigDecimal 1.3.3 for Ruby 2.5. This cop identifies places where `BigDecimal.new()` can be replaced by `BigDecimal()`. ```console % cat /tmp/example.rb # frozen_string_literal: true BigDecimal.new(123.456, 3) ``` ```console % rubocop /tmp/example.rb Inspecting 1 file W Offenses: /tmp/example.rb:3:12: W: Lint/BigDecimalNew: BigDecimal.new() is deprecated. Use BigDecimal() instead. BigDecimal.new(123.456, 3) ^^^ 1 file inspected, 1 offense detected ``` I have verified that these methods can be replaced using the lowest Ruby version 2.1 supported by RuboCop. ```console % ruby -v ruby 2.1.10p492 (2016-04-01 revision 54464) [x86_64-darwin13.0] % gem list | grep bigdecimal bigdecimal (default: 1.2.4) % ruby -rbigdecimal -e 'p BigDecimal(123.456, 3) == BigDecimal.new(123.456, 3)' true ``` ## Other Information The following is a change of BigDecimal 1.3.3 for Ruby 2.5 related to this PR. - ruby/bigdecimal@5337373 - ruby/bigdecimal@16738ad
17aeedc
to
1ab27e7
Compare
Feature
BigDecimal.new()
is deprecated since BigDecimal 1.3.3 for Ruby 2.5.This cop identifies places where
BigDecimal.new()
can be replaced byBigDecimal()
.I have verified that these methods can be replaced using the lowest
Ruby version 2.1 supported by RuboCop.
Other Information
The following is a change of BigDecimal 1.3.3 for Ruby 2.5 related to this PR.
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).and description in grammatically correct, complete sentences.
rake default
orrake parallel
. It executes all tests and RuboCop for itself, and generates the documentation.