class RuboCop::Cop::Chef::Deprecations::PowershellCookbookHelpers

Use `node['version']` or the new `powershell_version` helper available in Chef Infra Client 15.8+ instead of the deprecated PowerShell cookbook helpers

@example

#### incorrect
Powershell::VersionHelper.powershell_version?('4.0')

#### correct
node['powershell']['version'].to_f == 4.0

# better (Chef Infra Client 15.8+)
powershell_version == 4.0

Constants

MSG
RESTRICT_ON_SEND

Public Instance Methods

on_send(node) click to toggle source
# File lib/rubocop/cop/chef/deprecation/powershell_cookbook_helpers.rb, line 48
def on_send(node)
  ps_cb_helper?(node) do |ver|
    add_offense(node, message: MSG, severity: :warning) do |corrector|
      corrector.replace(node, "node['powershell']['version'].to_f == #{ver.source}")
    end
  end
end