Class: RuboCop::Cop::Chef::ChefDeprecations::NodeSet
- Inherits:
-
RuboCop::Cop
- Object
- RuboCop::Cop
- RuboCop::Cop::Chef::ChefDeprecations::NodeSet
- Defined in:
- lib/rubocop/cop/chef/deprecation/node_set.rb
Overview
The node.set method has been removed in Chef-13 and must be replaced by node.normal.
Note that node.normal keeps the semantics identical, but the use of node.normal is also discouraged.
Constant Summary collapse
- MSG =
'Do not use node.set. Replace with node.normal to keep identical behavior.'.freeze
Instance Method Summary collapse
Instance Method Details
#autocorrect(node) ⇒ Object
46 47 48 49 50 |
# File 'lib/rubocop/cop/chef/deprecation/node_set.rb', line 46 def autocorrect(node) lambda do |corrector| corrector.replace(node.loc.selector, 'normal') end end |
#on_send(node) ⇒ Object
40 41 42 43 44 |
# File 'lib/rubocop/cop/chef/deprecation/node_set.rb', line 40 def on_send(node) node_set?(node) do add_offense(node, location: :selector, message: MSG, severity: :refactor) end end |