Class: RuboCop::Cop::Chef::ChefDeprecations::RecipeMetadata

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

Overview

The recipe metadata.rb method is not used and is unnecessary in cookbooks. Recipes should be documented in the README.md file instead.

Examples:


# bad
recipe 'openldap::default', 'Install and configure OpenLDAP'

Constant Summary collapse

MSG =
'The recipe metadata.rb method is not used and is unnecessary in cookbooks. Recipes should be documented in the README.md file instead.'.freeze

Instance Method Summary collapse

Instance Method Details

#autocorrect(node) ⇒ Object



38
39
40
41
42
# File 'lib/rubocop/cop/chef/deprecation/recipe_metadata.rb', line 38

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

#on_send(node) ⇒ Object



34
35
36
# File 'lib/rubocop/cop/chef/deprecation/recipe_metadata.rb', line 34

def on_send(node)
  add_offense(node, location: :expression, message: MSG, severity: :refactor) if node.method_name == :recipe
end