Skip to content
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

Lint/NumberConversion suggests 30.minutes.to_i be turned into Integer(30.minutes, 10), which is invalid #8950

Closed
krainboltgreene opened this issue Oct 27, 2020 · 1 comment · Fixed by #8956

Comments

@krainboltgreene
Copy link

app/controllers/concerns/signed.rb:22:19: W: Lint/NumberConversion: Replace unsafe number conversion with number class parsing, instead of using 30.minutes.to_i, use stricter Integer(30.minutes, 10).
      expires_in: 30.minutes.to_i,
                  ^^^^^^^^^^^^^^^
[1] pry(main)> Integer(30.minutes, 10)
ArgumentError: base specified for non string value
from (pry):1:in `Integer'
$ [bundle exec] rubocop -V
1.0.0 (using Parser 2.7.2.0, rubocop-ast 1.0.0, running on ruby 2.6.6 x86_64-darwin19)
dvandersluis added a commit to dvandersluis/rubocop that referenced this issue Oct 28, 2020
…/NumberConversion`.

- Updated the hardcoded classes to ignore to be configurable instead
bbatsov pushed a commit that referenced this issue Oct 29, 2020
…Conversion` (#8956)

- Updated the hardcoded classes to ignore to be configurable instead
@krainboltgreene
Copy link
Author

Gracias, @bbatsov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant