Class: RuboCop::Cop::Chef::Modernize::RespondToResourceName
- Extended by:
- AutoCorrector
- Defined in:
- lib/rubocop/cop/chef/modernize/respond_to_resource_name.rb
Overview
Chef Infra Client 12.5 introduced the resource_name method for resources. Many cookbooks used respond_to?(:resource_name) to provide backwards compatibility with older chef-client releases. This backwards compatibility is no longer necessary.
Constant Summary collapse
- MSG =
'respond_to?(:resource_name) in resources is no longer necessary in Chef Infra Client 12.5+'
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#on_if(node) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/rubocop/cop/chef/modernize/respond_to_resource_name.rb', line 37 def on_if(node) if_respond_to_resource_name?(node) do add_offense(node, severity: :refactor) do |corrector| corrector.replace(node, node.children[1].source) end end end |