Skip to content

Conflicting lintr rules with alist and explicitly missing arguments #540

@richfitz

Description

@richfitz

This is pretty niche but shows up a conflicting pair of rules:

> lintr::lint("alist(a =)\n")
<text>:1:9: style: Put spaces around all infix operators.
alist(a =)
        ^~
> lintr::lint("alist(a = )\n")
<text>:1:10: style: Do not place spaces around code in parentheses or square brackets.
alist(a = )
         ^
> lintr::lint("alist(a =, b = NULL)\n")
<text>:1:9: style: Put spaces around all infix operators.
alist(a =, b = NULL)
        ^~
> lintr::lint("alist(a = , b = NULL)\n")
<text>:1:11: style: Commas should never have a space before.
alist(a = , b = NULL)

So for arguments that are "explicitly missing" there is no way of satisfying the default set of linter rules - we must and cannot have a space following the =, for cases that are within or at the end of an argument list.

The above behaviour is triggered in both the cran version (2.0.1) and current github (2.0.1.9000, eece3c1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    false-positivecode that shouldn't lint, but does

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions