Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a false positive for
Lint/NumberConversion
This PR fixes the following false positive and incorrect auto-correct for `Lint/NumberConversion` when `:to_f` is one of multiple method arguments. ```console % cat example.rb delegate :to_f, to: :description, allow_nil: true % bundle exec rubocop --only Lint/NumberConversion -A example.rb (snip) Inspecting 1 file W Offenses: example.rb:1:1: W: [Corrected] Lint/NumberConversion: Replace unsafe number conversion with number class parsing, instead of using :to_f, use stricter { |i| Float(i) }. delegate :to_f, to: :description, allow_nil: true ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1 file inspected, 1 offense detected, 1 offense corrected % cat example.rb delegate { |i| Float(i) }, to: :description, allow_nil: true % ruby -c example.rb example.rb:1: syntax error, unexpected ',', expecting end-of-input delegate { |i| Float(i) }, to: :description, allow_nil:... ```
- Loading branch information