Skip to content

spaces_inside_lintr lints alist() with missing default value #532

Closed

Description

@AshesITR

I think the spaces_inside_linter might need an exception for required arguments in alist() calls.

alist(x = )

defines formals of a function with one argument x that has no default value.
To me this form looks much more readable than

alist(x =)

Styler also agrees with me here:

styler::style_text("alist(x =)")
#> Warning: Could not use colored = TRUE, as the package prettycode is not
#> installed. Please install it if you want to see colored output or see `?
#> print.vertical` for more information.
#> alist(x = )
writeLines("alist(x = )", tmp <- tempfile())
lintr::lint(tmp, lintr::spaces_inside_linter)
#> C:\Users\Alex\AppData\Local\Temp\RtmpyMy4Oz\file374c142a1812:1:10: style: Do not place spaces around code in parentheses or square brackets.
#> alist(x = )
#>          ^

Created on 2020-10-08 by the reprex package (v0.3.0)

Activity

  1. AshesITR commented on Oct 24, 2020

    @AshesITR
    CollaboratorAuthor

    #540 shows that commas_linter needs a fix as well (reprex is alist(x = , y = 2L) for that linter)

  2. added
    bug
    on Dec 9, 2020
  3. AshesITR commented on Jan 31, 2021

    @AshesITR
    CollaboratorAuthor

    Superseeded by #540

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions