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

Lint deparse(substitute(x)) for deparse1(substitute(x)) #2615

Open
m-muecke opened this issue Jun 20, 2024 · 2 comments
Open

Lint deparse(substitute(x)) for deparse1(substitute(x)) #2615

m-muecke opened this issue Jun 20, 2024 · 2 comments

Comments

@m-muecke
Copy link

Since R 4.0.0 the pattern deparse1(substitute(x)) seems to be recommended over deparse(substitute(x)). See the PR for examples: https://bugs.r-project.org/show_bug.cgi?id=17671 but this most likely will have many false positives.

@m-muecke m-muecke changed the title Lint deparse(substitute(x)) for deparse1(substitute(x))` Lint deparse(substitute(x)) for deparse1(substitute(x)) Jun 20, 2024
@MichaelChirico
Copy link
Collaborator

I think deparse(substitute(x)) is error-prone, hence why deparse1() is recommended... but I'm not sure there's no legitimate need for plain deparse(substitute(x)), hence a lot of false positives like you say. I tend to shy away from linters that have a lot of built-in false positives, especially without a really good classification of good vs. bad use cases that we can convey concisely to the user in a lint message. Do you want to flesh something like that out?

Reconstructing deparse1(), i.e. paste(deparse(.), collapse = " "), is definitely lintable, OTOH.

@AshesITR
Copy link
Collaborator

We could use it
ourselves:

https://github.com/r-lib/lintr/blob/main/R/utils.R#L75

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants