lib/rubocop/cop/chef/modernize/respond_to_provides.rb in cookstyle-6.18.8 vs lib/rubocop/cop/chef/modernize/respond_to_provides.rb in cookstyle-6.19.5
- old
+ new
@@ -37,10 +37,10 @@
MSG = 'Using `respond_to?(:provides)` or `if defined? provides` in resources is no longer necessary in Chef Infra Client 12+.'
def on_if(node)
if_respond_to_provides?(node) do
add_offense(node, message: MSG, severity: :refactor) do |corrector|
- corrector.replace(node.loc.expression, node.children[1].source)
+ corrector.replace(node, node.children[1].source)
end
end
end
def_node_matcher :if_respond_to_provides?, <<~PATTERN