Class: RuboCop::Cop::Chef::Deprecations::NodeSetWithoutLevel
- Defined in:
- lib/rubocop/cop/chef/deprecation/node_set_without_level.rb
Overview
When setting a node attribute in Chef Infra Client 11 and later you must specify the precedence level.
Constant Summary collapse
- MSG =
'When setting a node attribute in Chef Infra Client 11 and later you must specify the precedence level.'
- RESTRICT_ON_SEND =
[:[]=, :<<].freeze
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#on_op_asgn(node) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/rubocop/cop/chef/deprecation/node_set_without_level.rb', line 41 def on_op_asgn(node) # make sure it was a += or -= if %i(- +).include?(node.node_parts[1]) (node.children&.first) end end |
#on_send(node) ⇒ Object
48 49 50 51 52 53 |
# File 'lib/rubocop/cop/chef/deprecation/node_set_without_level.rb', line 48 def on_send(node) # make sure the method being send is []= and then make sure the receiver is a send if %i([]= <<).include?(node.method_name) && node.receiver.send_type? (node) end end |