Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird error message in Layout/IndentHeredoc: "<<~ instead of <<~" #5498

Closed
herwinw opened this issue Jan 23, 2018 · 2 comments · Fixed by #5665
Closed

Weird error message in Layout/IndentHeredoc: "<<~ instead of <<~" #5498

herwinw opened this issue Jan 23, 2018 · 2 comments · Fixed by #5665

Comments

@herwinw
Copy link

herwinw commented Jan 23, 2018

Using the following rubocop config:

AllCops:
  TargetRubyVersion: 2.3

And this test script:

# frozen_string_literal: true

var = <<~TXT
 foobar
TXT
puts var

"foobar" is indented with a single space.
The following error message is shown:

heredoc.rb:4:1: C: Layout/IndentHeredoc: Use 2 spaces for indentation in a heredoc by using <<~ instead of <<~.
 foobar ...
^^^^^^^

The part about using <<~ instead of <<~ doesn't really make much sense.

$ rubocop -V
0.52.1 (using Parser 2.4.0.2, running on ruby 2.3.3 i386-linux-gnu)
@pocke
Copy link
Collaborator

pocke commented Jan 23, 2018

#4662 (comment)
It is already mentioned in the issue. Unfortunately it has not been fixed yet 😿

@fullofcaffeine
Copy link

+1

Hamada14 added a commit to Hamada14/rubocop that referenced this issue Mar 10, 2018
…lid indentation

This commit addresses using `<<~` with Heredoc but using an invalid indentation which results in this message, `Use 2 spaces for indentation in a heredoc by using <<~ instead of <<~`.
The message logic was modified where it can address both the operator and the indenation or only the indentation to avoid any confusion.

fixes rubocop#5498
bbatsov pushed a commit that referenced this issue Mar 12, 2018
…entation

This commit addresses using `<<~` with Heredoc but using an invalid indentation which results in this message, `Use 2 spaces for indentation in a heredoc by using <<~ instead of <<~`.
The message logic was modified where it can address both the operator and the indenation or only the indentation to avoid any confusion.

fixes #5498
This was referenced Mar 21, 2018
This was referenced Mar 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants