Rubocop: Errors when using double quotes in heredoc delimiters

Created on 18 Sep 2017  路  3Comments  路  Source: rubocop-hq/rubocop

The following piece of code is perfectly valid Ruby:

print <<"FOO"
  BAR
FOO

Since Rubocop 0.5.0, this results in parse errors:

2 errors occurred:
An error occurred while Naming/HeredocDelimiterCase cop was inspecting /opt/qnet-core/foo.rb:1:6.
An error occurred while Naming/HeredocDelimiterNaming cop was inspecting /opt/qnet-core/foo.rb:1:6.

RuboCop version

Include the output of rubocop -V. Here's an example:

$ rubocop -V
0.50.0 (using Parser 2.4.0.0, running on ruby 2.1.5 i386-linux-gnu)
bug

All 3 comments

I implemented these, so I'll have a look.

<<`FOO`
ls
FOO

Same problem occurs by this code also.

BTW, this cop has same problem about this code.
Because non-word character can be used as a heredoc delimiter.

<<'+'
BAR
+
Was this page helpful?
0 / 5 - 0 ratings