Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update IncludeResourceDescriptions to allow string interpolation #719

Merged
merged 1 commit into from
Aug 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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