Skip to content

Ruby heredoc with multiple lines should not be considered for Style/EndlessMethod #14663

@hlascelles

Description

@hlascelles

This is a follow-on from #14602 "Ruby heredoc should not be considered for Style/EndlessMethod" (thank you for moving on that so quickly!).

As of rubocop latest (v1.81.7) this code still (wrongly?) prompts to change to an EndlessMethod.

def foo
  puts <<~MSG
    Hello
    there....
  MSG
end

But this passes (correctly):

def foo
  puts <<~MSG
    Hello
  MSG
end

It appears that a single line heredoc is correctly handled, but when there are multiple lines it doesn't match as it should.

I can have a go at a PR if you like?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions