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

Style/IfUnlessModifier bad length calculation #8283

Closed
marcandre opened this issue Jul 9, 2020 · 0 comments
Closed

Style/IfUnlessModifier bad length calculation #8283

marcandre opened this issue Jul 9, 2020 · 0 comments
Labels

Comments

@marcandre
Copy link
Contributor

@marcandre marcandre commented Jul 9, 2020

Unless I'm mistaken, Style/IfUnlessModifier doesn't take into account the comment in the length, to check if the modifier form will fit or not.

if foo # this comment's length is not taken into account
  bar
end
# corrected to
bar if foo # this comment's length is not taken into account

Ideally the code to calculate this should use the exact same method that actually computes the replacement...

See also #8282 and #8281

@marcandre marcandre changed the title Style/WhileUntilModifier bad length calculation Style/IfUnlessModifier bad length calculation Jul 9, 2020
dmytro-savochkin pushed a commit to dmytro-savochkin/rubocop that referenced this issue Aug 2, 2020
dmytro-savochkin pushed a commit to dmytro-savochkin/rubocop that referenced this issue Aug 2, 2020
@bbatsov bbatsov closed this in #8435 Aug 3, 2020
bbatsov added a commit that referenced this issue Aug 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

1 participant
You can’t perform that action at this time.