Class: RuboCop::Cop::Chef::ChefDeprecations::RequireRecipe
- Inherits:
-
RuboCop::Cop
- Object
- RuboCop::Cop
- RuboCop::Cop::Chef::ChefDeprecations::RequireRecipe
- Defined in:
- lib/rubocop/cop/chef/deprecation/require_recipe.rb
Overview
Make sure to use include_recipe instead of require_recipe
Constant Summary collapse
- MSG =
'Use include_recipe instead of the require_recipe method'.freeze
Instance Method Summary collapse
Instance Method Details
#autocorrect(node) ⇒ Object
43 44 45 46 47 |
# File 'lib/rubocop/cop/chef/deprecation/require_recipe.rb', line 43 def autocorrect(node) lambda do |corrector| corrector.replace(node.loc.selector, 'include_recipe') end end |
#on_send(node) ⇒ Object
39 40 41 |
# File 'lib/rubocop/cop/chef/deprecation/require_recipe.rb', line 39 def on_send(node) require_recipe?(node) { add_offense(node, location: :selector, message: MSG, severity: :refactor) } end |