Skip to content

Keep space between commas #192

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

Closed
krlmlr opened this issue Sep 15, 2017 · 5 comments
Closed

Keep space between commas #192

krlmlr opened this issue Sep 15, 2017 · 5 comments

Comments

@krlmlr
Copy link
Member

krlmlr commented Sep 15, 2017

styler::style_text("call(arg, , more_args)")
#> call(arg,, more_args)
styler::style_text("call(trailing, comma, )")
#> call(trailing, comma, )

The second example looks good, the first needs a space between the commas.

@lorenzwalthert
Copy link
Collaborator

Is this convention or a rule from the tidyverse style guide? I guess you cannot really derive it from section 2.2.

Always put a space after a comma, and never before (just like in regular English).

Also, the style guide clarifies in section 2.3 that the following is bad style:

# Bad
mean(x = 1:10, , FALSE)

So I wonder what we should do about that.

@krlmlr
Copy link
Member Author

krlmlr commented Sep 16, 2017

2.3 is about naming arguments vs. omitting arguments, but sometimes we do need to explicitly pass a missing argument, e.g. in [. In these rare cases I'd prefer the commas to be separated by space because this seems easier to read.

@krlmlr
Copy link
Member Author

krlmlr commented Sep 16, 2017

So maybe 2.2 needs an extension?

@lorenzwalthert
Copy link
Collaborator

Ok, I can file an issue.

@lorenzwalthert
Copy link
Collaborator

Well I just thought about it and maybe it's not worth an extension in the style guide since it is a very rare thing. I can just implement directly.

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