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

Further extensions to paste_linter #1108

Closed
2 of 3 tasks
MichaelChirico opened this issue Apr 27, 2022 · 4 comments · Fixed by #2559
Closed
2 of 3 tasks

Further extensions to paste_linter #1108

MichaelChirico opened this issue Apr 27, 2022 · 4 comments · Fixed by #2559
Labels
feature a feature request or enhancement

Comments

@MichaelChirico
Copy link
Collaborator

MichaelChirico commented Apr 27, 2022

Branched off from #998 -- creating this issue to cover the remaining paste-related lints mentioned there that aren't making the 3.0.0 cut

@olivroy
Copy link
Collaborator

olivroy commented Apr 18, 2024

I just tripped on

paste0(x, collapse = )

Would love to see this implemented!

@MichaelChirico
Copy link
Collaborator Author

Could you elaborate what you mean by "tripped on"? The behavior of paste(x, collapse=) should be identical to that of paste0(x, collapse=), the advantage here is only for consistency/possibly readability, not anything to do with correctness.

@olivroy
Copy link
Collaborator

olivroy commented Apr 22, 2024

Oh, actually, I tripped on paste0(sep =). sep is ignored by paste0() which yielded bad results. Sorry for the confusion!

Edit: and there is already a linter for this. Please disregard :)

@MichaelChirico
Copy link
Collaborator Author

Your use case is already covered by paste_linter():

lintr::lint(text='paste0(a, sep="b")', linters=lintr::paste_linter())
# <text>:1:1: warning: [paste_linter] sep= is not a formal argument to paste0(); did you mean to use paste(), or collapse=?
# paste0(a, sep="b")
# ^~~~~~~~~~~~~~~~~~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants