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/WhileUntilModifier must copy logic from Style/IfUnlessModifier #8281

Closed
marcandre opened this issue Jul 9, 2020 · 1 comment
Closed
Assignees

Comments

@marcandre
Copy link
Contributor

marcandre commented Jul 9, 2020

There's a lot of logic in IfUnlessModifier that is missing from WhileUntilModifier.

  1. Looses comments:
while bar # important comment about to be nuked
  baz
end
# corrected to
baz while bar
  1. Incorrect correction for assignment:
foo = while bar
  baz
end
# corrected to
foo = baz while bar

This is logic that IfUnlessModifier has.

It should be moved into their shared module, and the corresponding tests should be moved in their shared context.

  1. Doesn't detect inline cases:
while foo; bar; end # => no offense

Again, IfUnless does the right thing. Same logic should be applied, tests should be moved in their shared context.

Found while checking #8273. See also #8282 and #8283

@marcandre
Copy link
Contributor Author

See also #8499

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