Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unneeded_concatenation_linter in magrittr pipes? #573

Closed
MichaelChirico opened this issue Nov 22, 2020 · 0 comments · Fixed by #585
Closed

unneeded_concatenation_linter in magrittr pipes? #573

MichaelChirico opened this issue Nov 22, 2020 · 0 comments · Fixed by #585

Comments

@MichaelChirico
Copy link
Collaborator

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)
@MichaelChirico MichaelChirico changed the title unneeded_concatenation_linter in magritter pipes? unneeded_concatenation_linter in magrittr pipes? Nov 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant