luisDVA / annotater

Annotate Package Load Calls
https://annotater.liomys.mx/
Other
99 stars 2 forks source link

Tests for `annotate_repo_source` fail with locally-installed version of packages (amongst others) #19

Closed gagolews closed 1 year ago

gagolews commented 1 year ago

Dear Luis,

After test-thatting your package against a locally-installed version of stringi, I get an error.

Actually, the assumptions you've made seem to cause the annotate_repo_source function to fail on any package that has not been fetched from CRAN.

Furthermore, even when annotate_repo_source("library(xxx)") works fine, then annotate_repo_source("library('xxx')") does not necessarily so.

Here are some calls/tests that can help you diagnose the issues....

Could you please fix the above and submit a corrected version to CRAN? Thank you.

Here's an example with another package (to show that it has nothing to do with stringi):

A version from CRAN

> install.packages('stringx')  
> annotater::annotate_repo_source('library(stringx)')
[1] "library(stringx) # CRAN v0.2.4"

A version fetched via install_github("gagolews/stringx")

> devtools::install_github("gagolews/stringx")
> annotater::annotate_repo_source('library(stringx)')
[1] "library(stringx) # [github::gagolews/stringx] v0.2.4"

However:

> annotater::annotate_repo_source('library("stringx")')
[1] "library(\"stringx\") # NA vNA"
Warning messages:
1: Problem while computing `user_repo = dplyr::case_when(...)`.
ℹ no package '"stringx"' was found 
2: Problem while computing `version = pkg_version(.data$package_name)`.
ℹ no package '"stringx"' was found 

A version installed from a local directory via R CMD INSTALL path_to_src_dir

> annotater::annotate_repo_source('library(stringx)')
Error in `dplyr::mutate()`:
! Problem while computing `repo = dplyr::if_else(.data$n == 1, "none", .data$repo)`.
Caused by error in `dplyr::if_else()`:
! `false` must be a character vector, not a logical vector.
Run `rlang::last_error()` to see where the error occurred.
gagolews commented 1 year ago

Actually it's even easier to reproduce - check out a self-test against your own package (installed from local sources):

> annotater::annotate_repo_source('library(annotater)')
[1] "library(annotater) # CRAN v0.2.2"
Error in `dplyr::mutate()`:
! Problem while computing `repo = dplyr::if_else(.data$n == 1, "none", .data$repo)`.
Caused by error in `dplyr::if_else()`:
! `false` must be a character vector, not a logical vector.
Run `rlang::last_error()` to see where the error occurred.
luisDVA commented 1 year ago

Hi! Thanks for the heads up, I'll look into this next week to try and find a solution asap.

luisDVA commented 1 year ago

fixed in development version, local installs now annotated, fixed issue with package names passed as names or as strings too