lib/rubocop/cop/chef/modernize/resource_name_initializer.rb in cookstyle-6.13.3 vs lib/rubocop/cop/chef/modernize/resource_name_initializer.rb in cookstyle-6.14.7
- old
+ new
@@ -46,15 +46,15 @@
add_offense(x, location: :expression, message: MSG, severity: :refactor)
end
end
end
- def_node_search :intialize_method, '(def :initialize ... )'
+ def_node_search :initialize_method, '(def :initialize ... )'
def autocorrect(node)
lambda do |corrector|
# insert the new resource_name call above the initialize method
- initialize_node = intialize_method(processed_source.ast).first
+ initialize_node = initialize_method(processed_source.ast).first
corrector.insert_before(initialize_node.source_range, "resource_name #{node.descendants.first.source}\n\n")
# remove the variable from the initialize method
corrector.remove(range_with_surrounding_space(range: node.loc.expression, side: :left))
end