Class: RuboCop::Cop::Chef::Deprecations::WindowsPackageInstallerTypeString
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Chef::Deprecations::WindowsPackageInstallerTypeString
- Extended by:
- AutoCorrector
- Includes:
- RuboCop::Chef::CookbookHelpers
- Defined in:
- lib/rubocop/cop/chef/deprecation/windows_package_installer_type_string.rb
Overview
In Chef Infra Client 13 and later the ‘windows_package` resource’s ‘installer_type` property must be a symbol.
Constant Summary collapse
- MSG =
"In Chef Infra Client 13 and later the `windows_package` resource's `installer_type` property must be a symbol."
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
Methods inherited from Base
Instance Method Details
#on_block(node) ⇒ Object
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/rubocop/cop/chef/deprecation/windows_package_installer_type_string.rb', line 46 def on_block(node) match_property_in_resource?(:windows_package, 'installer_type', node) do |offense| return unless offense.arguments.count == 1 # we can only analyze simple string args return unless offense.arguments.first.str_type? # anything else is fine add_offense(offense, severity: :warning) do |corrector| corrector.replace(offense.arguments.first.source_range, ":#{offense.arguments.first.value}") end end end |