class RuboCop::Cop::Chef::Deprecations::NodeSet

The ‘node.set` method has been removed in Chef Infra Client 13 and usage must be replaced with `node.normal`.

This cop will autocorrect code to use node.normal, which is functionally identical to node.set, but we also discourage the use of that method as normal level attributes persist on the node even if the code setting the attribute is later removed.

@example

#### incorrect
node.set['foo'] = true

#### correct
node.normal['foo'] = true

Constants

MSG
RESTRICT_ON_SEND

Public Instance Methods

on_send(node) click to toggle source
# File lib/rubocop/cop/chef/deprecation/node_set.rb, line 43
def on_send(node)
  node_set?(node) do
    add_offense(node.loc.selector, severity: :warning) do |corrector|
      corrector.replace(node.loc.selector, 'normal')
    end
  end
end