Class: RuboCop::Cop::Chef::ChefDeprecations::ChocolateyPackageUninstallAction
- Inherits:
-
RuboCop::Cop
- Object
- RuboCop::Cop
- RuboCop::Cop::Chef::ChefDeprecations::ChocolateyPackageUninstallAction
- Includes:
- RuboCop::Chef::CookbookHelpers
- Defined in:
- lib/rubocop/cop/chef/deprecation/chocolatey_package_uninstall_action.rb
Overview
Use the :remove action in the chocolatey_package resource instead of :uninstall which was removed in Chef Infra Client 14+
Constant Summary collapse
- MSG =
'Use the :remove action in the chocolatey_package resource instead of :uninstall which was removed in Chef Infra Client 14+'.freeze
Instance Method Summary collapse
Methods included from RuboCop::Chef::CookbookHelpers
#match_property_in_resource?, #match_resource_type?, #method_arg_ast_to_string, #resource_block_name_if_string
Instance Method Details
#autocorrect(node) ⇒ Object
49 50 51 52 53 |
# File 'lib/rubocop/cop/chef/deprecation/chocolatey_package_uninstall_action.rb', line 49 def autocorrect(node) lambda do |corrector| corrector.replace(node.loc.expression, ':remove') end end |
#on_block(node) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/rubocop/cop/chef/deprecation/chocolatey_package_uninstall_action.rb', line 41 def on_block(node) match_property_in_resource?(:chocolatey_package, 'action', node) do |choco_action| choco_action.arguments.each do |action| add_offense(action, location: :expression, message: MSG, severity: :refactor) if action.source == ':uninstall' end end end |