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

object_usage_linter (and probably others) use namespace of installed package #91

Closed
krlmlr opened this issue May 28, 2015 · 1 comment
Closed
Labels
bug an unexpected problem or unintended behavior feature a feature request or enhancement object linters 🏀
Milestone

Comments

@krlmlr
Copy link
Member

krlmlr commented May 28, 2015

Local changes to the NAMESPACE file are reflected only after package is installed. To reproduce:

pkgname="lintr.namespace.test"
rm -rf $pkgname
Rscript -e "devtools::create('$pkgname')"
Rscript -e "devtools::install('$pkgname')"
echo "a <- function() {" > $pkgname/R/a.R
echo "  llply" >> $pkgname/R/a.R
echo "}" >> $pkgname/R/a.R
echo "importFrom(plyr,llply)" > $pkgname/NAMESPACE

# Uncomment line below to fix error
#Rscript -e "devtools::install('$pkgname')"

Rscript -e "lintr::lint_package('$pkgname')"

An equivalent R script didn't exhibit the same error, so this one might be difficult to test automatically.

@jimhester
Copy link
Member

I am aware of this deficiency, but an unsure how to remedy it. The object_usage_linter loads the package namespace to check for defined globals, however the package actually needs to be installed in order for the namespace to be updated. It could use devtools::load_all() to load the namespace, but that unfortunately has issues with some packages (particularly S4 packages) and has some weird edge cases. But maybe load_all() is the way to go here...

@jimhester jimhester added bug an unexpected problem or unintended behavior enhancement labels Dec 30, 2015
@jimhester jimhester added this to the Jan. 4 milestone Dec 30, 2015
@jimhester jimhester added feature a feature request or enhancement and removed enhancement labels May 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior feature a feature request or enhancement object linters 🏀
Projects
None yet
Development

No branches or pull requests

2 participants