Class: RuboCop::Cop::Chef::ChefEffortless::CookbookUsesDatabags

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

Overview

Data bags cannot be used with the Effortless Infra pattern

Examples:


# bad
data_bag_item('admins', )
data_bag(data_bag_name)

Constant Summary collapse

MSG =
'Cookbook uses data bags, which cannot be used in the Effortless Infra pattern'.freeze

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



31
32
33
# File 'lib/rubocop/cop/chef/effortless/data_bags.rb', line 31

def on_send(node)
  add_offense(node, location: :expression, message: MSG, severity: :refactor) if %i(data_bag data_bag_item).include?(node.method_name)
end