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

spacing around tilde #315

Closed
lorenzwalthert opened this Issue Jan 6, 2018 · 6 comments

Comments

Projects
None yet
2 participants
@lorenzwalthert
Copy link
Collaborator

lorenzwalthert commented Jan 6, 2018

I think styler should make sure there is at least one space around the tilde operator.

library(styler)
style_text("lm(a~b, data = x)")
#> lm(a~b, data = x)
style_text("lm(a~b, data = x)")
#> lm(a~b, data = x)
style_text("map2(
  x, y,~lines[seq2(.x + 1, .y - 1)]
)")
#> map2(
#>   x, y, ~lines[seq2(.x + 1, .y - 1)]
#> )

Created on 2018-01-06 by the reprex
package
(v0.1.1.9000).

@lorenzwalthert

This comment has been minimized.

Copy link
Collaborator Author

lorenzwalthert commented Jan 8, 2018

@krlmlr do you agree on adding a space around ~? I think it's not covered in the tidyverse style guide because it's not particularly relevant since lazy evaluation is mostly substituted with tidyeval in many places these days. Or should we request to extend the examples in the style guide?

@krlmlr

This comment has been minimized.

Copy link
Member

krlmlr commented Jan 14, 2018

Thanks, missed that. How do we treat formulas without LHS?

@lorenzwalthert

This comment has been minimized.

Copy link
Collaborator Author

lorenzwalthert commented Jan 15, 2018

I'd suggest we don't add a space on the left hand side as it's currently implemented.

styler::style_text("(~k)")
#> (~ k)

Created on 2018-01-15 by the reprex package (v0.1.1.9000).

lorenzwalthert referenced this issue in tidyverse/dplyr Mar 13, 2018

@krlmlr

This comment has been minimized.

Copy link
Member

krlmlr commented Mar 21, 2018

Reopening, because we're not covering rhs-only formulas yet (also in the tests).

@krlmlr krlmlr reopened this Mar 21, 2018

@lorenzwalthert

This comment has been minimized.

Copy link
Collaborator Author

lorenzwalthert commented Mar 23, 2018

Reference: tidyverse/dplyr@0818cab#r28070282 in file data-raw/band_members.R

@krlmlr

This comment has been minimized.

Copy link
Member

krlmlr commented Apr 15, 2018

Thanks for looking into it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.