diff --git a/lib/rubocop/cop/chef/sharing/include_resource_descriptions.rb b/lib/rubocop/cop/chef/sharing/include_resource_descriptions.rb index 6a90d53e9..46d08170a 100644 --- a/lib/rubocop/cop/chef/sharing/include_resource_descriptions.rb +++ b/lib/rubocop/cop/chef/sharing/include_resource_descriptions.rb @@ -44,7 +44,7 @@ def investigate(processed_source) add_offense(nil, location: range, message: MSG, severity: :refactor) unless resource_description(processed_source.ast).any? end - def_node_search :resource_description, '(send nil? :description str ...)' + def_node_search :resource_description, '(send nil? :description ...)' end end end diff --git a/spec/rubocop/cop/chef/sharing/include_resource_descriptions_spec.rb b/spec/rubocop/cop/chef/sharing/include_resource_descriptions_spec.rb index 0087a8c7e..b79dadf17 100644 --- a/spec/rubocop/cop/chef/sharing/include_resource_descriptions_spec.rb +++ b/spec/rubocop/cop/chef/sharing/include_resource_descriptions_spec.rb @@ -34,4 +34,12 @@ description 'foo does a thing' RUBY end + + it "doesn't register an offense when a resource contains a description with string interpolation" do + expect_no_offenses(<<~'RUBY') + resource_name 'foo' + val = 'thing' + description "foo does a #{val}" + RUBY + end end