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

FirstParameterIndentation in interpolated string works strangely #1638

Closed
bquorning opened this issue Feb 5, 2015 · 1 comment
Closed

FirstParameterIndentation in interpolated string works strangely #1638

bquorning opened this issue Feb 5, 2015 · 1 comment
Assignees
Labels

Comments

@bquorning
Copy link
Contributor

puts %(
  <p>
    #{Array(
      42
    )}
  </p>
)

Running bin/rubocop --only Style/FirstParameterIndentation on the above code, I am told to properly indent the line containing 42.

The strange thing here is that the recommended position seems to be 2 spaces more than the position of <p>. I would assume the indentation of the un-interpolated parts of the string would have no influence on the indentation recommendation of the interpolated parts.

From my testing, it seems that this bug only presents itself when the interpolated string contains a method call with its argument(s) on a new line(s).

@jonas054 jonas054 self-assigned this Feb 6, 2015
@jonas054 jonas054 added the bug label Feb 6, 2015
@jonas054
Copy link
Collaborator

jonas054 commented Feb 6, 2015

It's the old regexp matching trap. #{Array( is mistaken for a comment line. I'll have it fixed soon.

bbatsov added a commit that referenced this issue Feb 6, 2015
…tion

[Fix #1638] Better comment matching in FirstParameterIndentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants