lib/rubocop/cop/chef/deprecation/deprecated_mixins.rb in cookstyle-5.18.4 vs lib/rubocop/cop/chef/deprecation/deprecated_mixins.rb in cookstyle-5.19.9
- old
+ new
@@ -32,10 +32,12 @@
# require 'chef/mixin/language'
# require 'chef/mixin/language_include_attribute'
# require 'chef/mixin/language_include_recipe'
#
class UsesDeprecatedMixins < Cop
+ include RangeHelp
+
MSG = "Don't use deprecated Mixins no longer included in Chef Infra Client 14 and later.".freeze
def_node_matcher :deprecated_mixin?, <<-PATTERN
(send nil? :include (const (const (const nil? :Chef) :Mixin) { :Language :LanguageIncludeAttribute :RecipeDefinitionDSLCore :LanguageIncludeRecipe }))
PATTERN
@@ -62,10 +64,10 @@
end
end
def autocorrect(node)
lambda do |corrector|
- corrector.remove(node.loc.expression)
+ corrector.remove(range_with_surrounding_space(range: node.loc.expression, side: :left))
end
end
end
end
end