Class: RuboCop::Cop::Chef::Deprecations::ChefHandlerRecipe

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

Overview

There is no need to include the empty and deprecated chef_handler::default recipe to use the chef_handler resource

Examples:


### incorrect
include_recipe 'chef_handler'
include_recipe 'chef_handler::default'

Constant Summary collapse

MSG =
'There is no need to include the empty and deprecated chef_handler::default recipe to use the chef_handler resource'
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
# File 'lib/rubocop/cop/chef/deprecation/chef_handler_recipe.rb', line 41

def on_send(node)
  chef_handler_recipe?(node) do
    add_offense(node, severity: :refactor) do |corrector|
      corrector.remove(range_with_surrounding_space(range: node.loc.expression, side: :left))
    end
  end
end