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

feature request: R CMD check and no visible binding for global variable #1714

Closed
IndrajeetPatil opened this issue Feb 22, 2018 · 2 comments
Closed

Comments

@IndrajeetPatil
Copy link
Contributor

Hi,

I know that the issue of R CMD check and the copious amounts of no visible binding for global variable [variable name] NOTES it produces has been raised in other forums (e.g., on StackOverflow: https://stackoverflow.com/questions/9439256/how-can-i-handle-r-cmd-check-no-visible-binding-for-global-variable-notes-when, or in the context of other packages: tidyverse/magrittr#29), but the solutions provided therein are either not satisfactory or are actually problematic to the package since the solutions themselves introduce some additional notes/warnings, especially if this is your first time developing package and you are encountering this problem for the first time.

So I was wondering if the future release of devtools can have some routines that automatically take the necessary steps to remove this particular breed of NOTES (e.g., automatically adding necessary variables via globalVariables(c(...)) or setting them to NULL, etc.) since it seems like a very common problem that people encounter and is frustrating to get rid off.

@jimhester
Copy link
Member

utils::globalVariables() is the correct solution to the problem and doesn't introduce any additional issues.

I don't like the idea of providing a helper because there are plenty of cases where this check does catch an issue (a typo in a variable name for instance, or forgetting to include a variable as a function argument), so I think this is something a human needs to look at and verify they are really false positives.

It is possible there could be a usethis helper which would help construct the globalVariables() call for you but it would be somewhat tricky to do correctly. I think if this was anywhere it would be there rather than in devtools.

@lock
Copy link

lock bot commented Sep 17, 2018

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Sep 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants