Skip to content

False positive in pipe_continuation_linter when code has nested pipes #2631

Open
@javieriserte

Description

@javieriserte

When a piece of code has two pipes, one nested inside another like in example code below:

c("1", "2", "3", "4") |>
  sapply(function(x) x |> runif() |> mean()) |>
  as.character()

the linter produces a false positive:

<text>:2:46: style: [pipe_continuation_linter] `|>` should always have a space before it and a new line after it, unless the full pipeline fits on one line.
  sapply(function(x) x |> runif() |> mean()) |>
                                         ^~

I think that the linter may consider the expression like a single pipe, instead of two nested pipes.

I'm using lintr 3.1.2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions