Class: RuboCop::Cop::Style::RedundantHeredocDelimiterQuotes
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Style::RedundantHeredocDelimiterQuotes
- Extended by:
- AutoCorrector
- Includes:
- Heredoc
- Defined in:
- lib/rubocop/cop/style/redundant_heredoc_delimiter_quotes.rb
Overview
Checks for redundant heredoc delimiter quotes.
Constant Summary collapse
- MSG =
'Remove the redundant heredoc delimiter quotes, use `%<replacement>s` instead.'
- STRING_INTERPOLATION_OR_ESCAPED_CHARACTER_PATTERN =
/#(\{|@|\$)|\\/.freeze
Constants included from Heredoc
Instance Method Summary collapse
Methods included from AutoCorrector
Methods included from Heredoc
Instance Method Details
#on_heredoc(node) ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/rubocop/cop/style/redundant_heredoc_delimiter_quotes.rb', line 36 def on_heredoc(node) return if need_heredoc_delimiter_quotes?(node) replacement = "#{heredoc_type(node)}#{delimiter_string(node)}" add_offense(node, message: format(MSG, replacement: replacement)) do |corrector| corrector.replace(node, replacement) end end |