Skip to content

unneeded_concatenation_linter in magrittr pipes? #573

Description

@MichaelChirico

Consider

writeLines('
"a" %>%
  c("b")
', tmp <- tempfile())
lintr::lint(tmp, lintr::unneeded_concatenation_linter)
# /tmp/Rtmp0PRc3M/fileacb8a79d41ebb:3:3: warning: Unneeded concatenation of a constant. Remove the "c" call.
#  c("b")
#   ^

Should we allow an exception for such cases?

The way to silence the linter is to use ., which may in fact be more readable:

writeLines('
"a" %>%
  c( . ,"b")
', tmp <- tempfile())
lintr::lint(tmp, lintr::unneeded_concatenation_linter)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions