rubocop
rubocop copied to clipboard
False negative for `Layout/LineLength` with split heredoc
Expected behavior
Given this code, and max line length set to 120:
x = <<~FOO
a \
abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef abcdef
FOO
RuboCop should complain with Layout/LineLength: Line is too long. [127/120].
Actual behavior
RuboCop doesn't complain. But if I set ParserEngine: parser_prism, then it correctly reports the issue.
RuboCop version
Include the output of rubocop -V or bundle exec rubocop -V if using Bundler.
If you see extension cop versions (e.g. rubocop-performance, rubocop-rspec, and others)
output by rubocop -V, include them as well. Here's an example:
$ [bundle exec] rubocop -V
1.63.1 (using Parser 3.2.2.3, rubocop-ast 1.29.0, running on ruby 3.2.2) [x86_64-linux]
- rubocop-performance 1.18.0
- rubocop-rspec 2.23.2