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

Layout/DotPosition with EnforcedStyle of 'trailing' is confused by heredocs with .squish #10144

Closed
codebender opened this issue Sep 29, 2021 · 3 comments

Comments

@codebender
Copy link

I ran into this after upgrading rubocop from version 1.17.0 to 1.22.0.

After adding .squish to a heredoc, which rails rubocop suggested, Layout/DotPosition started reporting Place the . on the previous line, together with the method call receiver.. The problem does seem related to the EnforcedStyle: trailing for that cop.

Example:

class Test
  def query
    <<-SQL.squish
      SELECT * FROM tests
    SQL
  end
end

This recent PR added a different fix for Layout/DotPosition & heredocs, but might have introduced this bug. 🤷‍♂️


Expected behavior

No reported problems with the code

Actual behavior

Describe here what actually happened.
Layout/DotPosition: Place the . on the previous line, together with the method call receiver. <<-SQL.squish

Steps to reproduce the problem

Add .squish to a heredoc

RuboCop version

$ bundle exec rubocop -V                                                                                                                                          
1.22.0 (using Parser 3.0.2.0, rubocop-ast 1.12.0, running on ruby 2.7.4 x86_64-darwin19)
  - rubocop-performance 1.11.5
  - rubocop-rails 2.12.2
@dvandersluis
Copy link
Member

dvandersluis commented Sep 29, 2021

Thanks for the great issue report, but this is actually a duplicate of #10140, which is already fixed (but not merged yet) by #10141.

@codebender
Copy link
Author

Oh sorry about that, I didn't see that one 👍

@dvandersluis
Copy link
Member

No worries - I’ve updated the title of the other ticket to hopefully be easier to find now! Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants