You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running roxygenize on a package with undocumented S3 methods and without srcrefs fails as follows:
Error in map2(undocumented, names(undocumented), function(fun, name) { :
ℹ In index: 1.
ℹ With name: c.blah.
Caused by error in `basename()`:
! a character vector argument expected
The error relates to the addition of checks for undocumented S3 methods from #1534 which implicitly assumes srcrefs are always present. Downstream code then fails because it gets NULL instead of a string.
Recreating the error is a bit tricky b/c we need a package without srcrefs, but here is a reasonably small example that reproduces the error:
pkg.name <- 'pkguqhr'
DESCRIPTION <- sprintf('
Package: %s
Version: 0.0
Encoding: UTF-8
Roxygen: list(load="installed")', pkg.name)
NAMESPACE <- ''
RCODE <- 'c.blah <- function(...) NULL'
if(!pkg.name %in% rownames(installed.packages())) {
pkg.dir <- tempfile(pkg.name)
dir.create(file.path(pkg.dir, "R"), recursive=TRUE)
writeLines(DESCRIPTION, file.path(pkg.dir, 'DESCRIPTION'))
writeLines(NAMESPACE, file.path(pkg.dir, 'NAMESPACE'))
writeLines(RCODE, file.path(pkg.dir, 'R', 'pkg.R'))
install.packages(pkg.dir, type='src', repos=NULL, quiet=TRUE)
try(roxygen2::roxygenise(pkg.dir))
remove.packages(pkg.name)
} else {
stop(
"Please either remove ", pkg.name,
" or find another name for this test package"
)
}
Notice the Roxygen: list(load="installed"). Assuming the above is in test.R then:
R --vanilla -q -f test.R
Reproduces the error.
Relates to #1589. #1711 provides a simple fix, but probably better would be to have an accessor function for srcrefs that is guaranteed to return in standard format, and then use that function everywhere, but that's a bigger change.
The text was updated successfully, but these errors were encountered:
smilberg
pushed a commit
to smilberg/roxygen2
that referenced
this issue
Apr 20, 2025
Running
roxygenize
on a package with undocumented S3 methods and without srcrefs fails as follows:The error relates to the addition of checks for undocumented S3 methods from #1534 which implicitly assumes srcrefs are always present. Downstream code then fails because it gets NULL instead of a string.
Recreating the error is a bit tricky b/c we need a package without srcrefs, but here is a reasonably small example that reproduces the error:
Notice the
Roxygen: list(load="installed")
. Assuming the above is intest.R
then:Reproduces the error.
Relates to #1589. #1711 provides a simple fix, but probably better would be to have an accessor function for srcrefs that is guaranteed to return in standard format, and then use that function everywhere, but that's a bigger change.
The text was updated successfully, but these errors were encountered: