Class: RuboCop::Cop::Chef::Deprecations::ChefHandlerUsesSupports
- Extended by:
- AutoCorrector
- Includes:
- RuboCop::Chef::CookbookHelpers
- Defined in:
- lib/rubocop/cop/chef/deprecation/chef_handler_supports.rb
Overview
Use the type ‘property` instead of the deprecated `supports` property in the `chef_handler` resource. The `supports` property was removed in `chef_handler` cookbook version 3.0 (June 2017) and Chef Infra Client 14.0.
Constant Summary collapse
- MSG =
'Use the type property instead of the deprecated supports property in the chef_handler resource. The supports property was removed in chef_handler cookbook version 3.0 (June 2017) and Chef Infra Client 14.0.'
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
42 43 44 45 46 47 48 49 50 |
# File 'lib/rubocop/cop/chef/deprecation/chef_handler_supports.rb', line 42 def on_block(node) match_property_in_resource?(:chef_handler, 'supports', node) do |prop_node| add_offense(prop_node, severity: :warning) do |corrector| # make sure to delete leading and trailing {}s that would create invalid ruby syntax extracted_val = prop_node.arguments.first.source.gsub(/{|}/, '') corrector.replace(prop_node, "type #{extracted_val}") end end end |