Class: RuboCop::Cop::Chef::ChefDeprecations::IncludingYumDNFCompatRecipe

Inherits:
RuboCop::Cop
  • Object
show all
Defined in:
lib/rubocop/cop/chef/deprecation/yum_dnf_compat_recipe.rb

Overview

Don’t include the deprecated yum DNF compatibility recipe, which is no longer necessary as Chef Infra Client includes DNF package support

Examples:


# bad
include_recipe 'yum::dnf_yum_compat'

Constant Summary collapse

MSG =
'Do not include the deprecated yum::dnf_yum_compat default recipe to install yum on dnf systems. Chef Infra Client now includes built in support for DNF packages.'.freeze

Instance Method Summary collapse

Instance Method Details

#autocorrect(node) ⇒ Object



42
43
44
45
46
# File 'lib/rubocop/cop/chef/deprecation/yum_dnf_compat_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/yum_dnf_compat_recipe.rb', line 36

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