Module: RuboCop::Chef::AutocorrectHelpers
- Included in:
- RuboCop::Cop::Chef::RedundantCode::AttributeMetadata, RuboCop::Cop::Chef::RedundantCode::GroupingMetadata, RuboCop::Cop::Chef::RedundantCode::LongDescriptionMetadata, RuboCop::Cop::Chef::RedundantCode::RecipeMetadata
- Defined in:
- lib/rubocop/chef/autocorrect_helpers.rb
Overview
Helpers for use in autocorrection
Instance Method Summary collapse
-
#expression_including_heredocs(node) ⇒ Object
if the node has a heredoc as an argument you’ll only get the start of the heredoc and removing the node will result in broken ruby.
Instance Method Details
#expression_including_heredocs(node) ⇒ Object
if the node has a heredoc as an argument you’ll only get the start of the heredoc and removing the node will result in broken ruby. This way we match the node and the entire heredoc for removal
24 25 26 27 28 29 30 |
# File 'lib/rubocop/chef/autocorrect_helpers.rb', line 24 def expression_including_heredocs(node) if node.arguments.last.respond_to?(:heredoc?) && node.arguments.last.heredoc? node.loc.expression.join(node.arguments.last.loc.heredoc_end) else node.loc.expression end end |