Class: RuboCop::Cop::Chef::Deprecations::IncludingYumDNFCompatRecipe

Inherits:
Base
  • Object
show all
Extended by:
AutoCorrector
Includes:
RangeHelp
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:


### incorrect
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.'
RESTRICT_ON_SEND =
[:include_recipe].freeze

Instance Method Summary collapse

Methods inherited from Base

#target_chef_version

Instance Method Details

#on_send(node) ⇒ Object



41
42
43
44
45
46
47
48
# File 'lib/rubocop/cop/chef/deprecation/yum_dnf_compat_recipe.rb', line 41

def on_send(node)
  yum_dnf_compat_recipe_usage?(node) do
    node = node.parent if node.parent&.conditional? && node.parent&.single_line?
    add_offense(node, severity: :warning) do |corrector|
      corrector.remove(range_with_surrounding_space(range: node.loc.expression, side: :left))
    end
  end
end