class RuboCop::Cop::Chef::Correctness::SupportsMustBeFloat

Versions used in metadata.rb supports calls should be floats not integers.

@example

#### incorrect
supports 'redhat', '> 8'

#### correct
supports 'redhat', '> 8.0'

Constants

MSG
RESTRICT_ON_SEND

Public Instance Methods

on_send(node) click to toggle source
# File lib/rubocop/cop/chef/correctness/supports_must_be_float.rb, line 40
def on_send(node)
  supports_with_constraint?(node) do |ver|
    return if ver.source.include?('.')
    add_offense(ver, severity: :refactor) do |corrector|
      corrector.replace(ver, ver.source.gsub(ver.value, (ver.value + '.0')))
    end
  end
end