Class: RuboCop::Cop::Chef::ChefDeprecations::IncludingXMLRubyRecipe

Inherits:
RuboCop::Cop
  • Object
show all
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:


# bad
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.'.freeze

Instance Method Summary collapse

Instance Method Details

#autocorrect(node) ⇒ Object



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

def autocorrect(node)
  lambda do |corrector|
    corrector.remove(node.loc.expression)
  end
end

#on_send(node) ⇒ Object



36
37
38
39
40
# File 'lib/rubocop/cop/chef/deprecation/xml_ruby_recipe.rb', line 36

def on_send(node)
  xml_ruby_recipe?(node) do
    add_offense(node, location: :expression, message: MSG, severity: :refactor)
  end
end