Class: RuboCop::Cop::Chef::Deprecations::SearchUsesPositionalParameters

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

Overview

correct

query(:node, ‘:’)

search(:node, '*:*', start: 0, rows: 1000, filter_result: { :ip_address => ["ipaddress"] })
search(:node, '*:*', start: 0, rows: 1000)
search(:node, '*:*', start: 0)

Constant Summary collapse

MSG =
"Don't use deprecated positional parameters in cookbook search queries."
RESTRICT_ON_SEND =
[:search].freeze
NAMED_PARAM_LOOKUP_TABLE =
[nil, nil, 'start', 'rows', 'filter_result'].freeze

Instance Method Summary collapse

Methods inherited from Base

#target_chef_version

Instance Method Details

#on_send(node) ⇒ Object



50
51
52
53
54
55
56
# File 'lib/rubocop/cop/chef/deprecation/search_uses_positional_parameters.rb', line 50

def on_send(node)
  search_method?(node) do
    add_offense(node, severity: :warning) do |corrector|
      corrector.replace(node, corrected_string(node))
    end if positional_arguments?(node)
  end
end