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

Fails to detect used libraries on code #218

Closed
latot opened this issue Dec 1, 2023 · 2 comments
Closed

Fails to detect used libraries on code #218

latot opened this issue Dec 1, 2023 · 2 comments
Labels
reprex needs a minimal reproducible example

Comments

@latot
Copy link

latot commented Dec 1, 2023

Hi all, I have uploaded a sample, when we run rcmdcheck::rcmdcheck we can found this message:

N  checking dependencies in R code ...
   Namespace in Imports field not imported from:geotypesAll declared Imports should be used.

So, what is the point, is that geotypes is being used on the library, also if you try replace geotypes with a function from for example typed library there is no errors.

No idea why this happens.

bug_typed.zip

geotypes lib: https://github.com/CIT-UAI/geotypes

Thx!

@gaborcsardi
Copy link
Member

It is very unlikely that this is an issue with rcmdcheck. Most likely you are not importing anything from the geotypes package, even though you put it in Imports in DESCRIPTION.

@gaborcsardi gaborcsardi added the reprex needs a minimal reproducible example label Dec 1, 2023
@gaborcsardi
Copy link
Member

I see that same issue with R CMD check, so this is not an issue with rcmdcheck. I suspect that thanks to typed, R CMD check is unable to see that you are actually using the geotypes package:

cassert <- typed::as_assertion_factory(function(
  value
) {

  ret <- geotypes::Data.frame()
  value

})
print(cassert, useSource = FALSE)
...
    header <- call("{", quote(f <- function (value)
    {
        ret <- geotypes::Data.frame()
        value
    }), substitute(value <- F_CALL, list(F_CALL = f_call)))
...

typed::as_assertion_factory() creates a function object in which the original function is embedded into quote(), which R CMD check does not consider as package code.

This seems like a general issue with the typed package. A workaround is to refer to that package elsewhere, e.g. put a dummy function like this into the package:

dummy <- function() {
  geotypes::Data.frame
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reprex needs a minimal reproducible example
Projects
None yet
Development

No branches or pull requests

2 participants