Class: RuboCop::Cop::Chef::Deprecations::IncludingXMLRubyRecipe

Inherits:
Base
  • Object
show all
Extended by:
AutoCorrector
Defined in:
lib/rubocop/cop/chef/deprecation/xml_ruby_recipe.rb

Overview

Do not include the deprecated xml::ruby recipe to install the nokogiri gem. Chef Infra Client 12 and later ships with nokogiri included.

Examples:


### incorrect
include_recipe 'xml::ruby'

Constant Summary collapse

MSG =
'Do not include the deprecated xml::ruby recipe to install the nokogiri gem. Chef Infra Client 12 and later ships with nokogiri included.'
RESTRICT_ON_SEND =
[:include_recipe].freeze

Instance Method Summary collapse

Methods inherited from Base

#target_chef_version

Instance Method Details

#on_send(node) ⇒ Object



39
40
41
42
43
44
45
46
# File 'lib/rubocop/cop/chef/deprecation/xml_ruby_recipe.rb', line 39

def on_send(node)
  xml_ruby_recipe?(node) do
    node = node.parent if node.parent&.conditional? && node.parent&.single_line_condition? # make sure we catch any inline conditionals
    add_offense(node, severity: :warning) do |corrector|
      corrector.remove(node)
    end
  end
end