Skip to content

Keep space between commas #192

Closed
Closed

Description

@krlmlr
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.

Activity

  1. lorenzwalthert commented on Sep 15, 2017

    @lorenzwalthert
    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.

  2. krlmlr commented on Sep 16, 2017

    @krlmlr
    MemberAuthor

    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.

  3. krlmlr commented on Sep 16, 2017

    @krlmlr
    MemberAuthor

    So maybe 2.2 needs an extension?

  4. lorenzwalthert commented on Sep 16, 2017

    @lorenzwalthert
    Collaborator

    Ok, I can file an issue.

  5. lorenzwalthert commented on Sep 16, 2017

    @lorenzwalthert
    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions