Class: RuboCop::Cop::Chef::ChefEffortless::CookbookUsesSearch

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

Overview

Search is not compatible with the Effortless Infra pattern

Examples:


# bad
search(:node, 'run_list:recipe\[bacula\:\:server\]')

Constant Summary collapse

MSG =
'Cookbook uses search, 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/search_used.rb', line 31

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