Class: RuboCop::Cop::Chef::Deprecations::NodeSet
- Extended by:
- AutoCorrector
- Defined in:
- lib/rubocop/cop/chef/deprecation/node_set.rb
Overview
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.
Constant Summary collapse
- MSG =
'Do not use node.set. Replace with node.normal to keep identical behavior.'
- RESTRICT_ON_SEND =
[:set].freeze
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#on_send(node) ⇒ Object
43 44 45 46 47 48 49 |
# 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 |