class RuboCop::Cop::Chef::Deprecations::ChocolateyPackageUninstallAction

Use the `:remove` action in the `chocolatey_package` resource instead of `:uninstall` which was removed in Chef Infra Client 14+.

@example

#### incorrect
chocolatey_package 'nginx' do
  action :uninstall
end

#### correct
chocolatey_package 'nginx' do
  action :remove
end

Constants

MSG

Public Instance Methods

on_block(node) click to toggle source
# File lib/rubocop/cop/chef/deprecation/chocolatey_package_uninstall_action.rb, line 42
def on_block(node)
  match_property_in_resource?(:chocolatey_package, 'action', node) do |choco_action|
    choco_action.arguments.each do |action|
      next unless action.source == ':uninstall'
      add_offense(action, message: MSG, severity: :warning) do |corrector|
        corrector.replace(action, ':remove')
      end
    end
  end
end