rubocop / rubocop

A Ruby static code analyzer and formatter, based on the community Ruby style guide.

Home Page:https://docs.rubocop.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unexpected `Layout/HeredocIndentation` cop on the latest Prism parser

viralpraxis opened this issue · comments

Expected behavior

I'm not sure if this is prism's or rubocop's issue, didn't find any related issues

Consider the following heredoc

<<~TXT
  #{1 + 1}
  foo
TXT

I expect Layout/HeredocIndentation not to find anything suspicios.

Actual behavior

C: [Correctable] Layout/HeredocIndentation: Use 2 spaces for indentation in a heredoc. (https://rubystyle.guide#squiggly-heredocs)
      #{1 + 1} ...

Moreover, running with autocorrect just pushes heredoc content to the right indefinetely.

Note that

<<~TXT
  foo
  #{1 + 1}
TXT

does not trigger the cop.

RuboCop version

1.62.1 (using Prism 0.24.0, rubocop-ast 1.31.2, running on ruby 3.3.0) [x86_64-linux]

Prism ref 19177b861e96