pkgdown icon indicating copy to clipboard operation
pkgdown copied to clipboard

pkgdown 2.0.0 erroring for class names containing colons.

Open stefanoborini opened this issue 3 years ago • 6 comments

It seems that pkgdown incorrectly parses an S3 method for a class called "maraca::maraca", and assumes plot.maraca::maraca is coming from a package plot.maraca.

Rscript -e "pkgdown::build_site()"
Using environment r4 (R version: 4.0.4, platform: x86_64-apple-darwin17.0)
Warning: Failed to parse usage:

S3method(`plot`, ``maraca::maraca``)(
  x,
  continuous_grid_spacing_x = 10,
  trans = "identity",
  density_plot_type = "default",
  vline_type = "median",
  ...
)

-- Installing package into temporary library -----------------------------------
Using environment r4 (R version: 4.0.4, platform: x86_64-apple-darwin17.0)
== Building pkgdown site =======================================================
Reading from: '/Users/Work/Repos/AstraZeneca/maraca'
Writing to:   '/Users/Work/Repos/AstraZeneca/maraca/site'
-- Initialising site -----------------------------------------------------------
-- Building home ---------------------------------------------------------------
Writing 'authors.html'
Reading 'AUTHORS.md'
Writing 'AUTHORS.html'
Reading 'CONTRIBUTING.md'
Reading 'LICENSE.md'
Writing '404.html'
-- Building function reference -------------------------------------------------
Error in .f(.x[[1L]], .y[[1L]], ...) : 
  The package ``plot.maraca` is required as it's used in the reference
index.
Error: 
! error in callr subprocess
Caused by error in `.f(.x[[1L]], .y[[1L]], ...)`:
! The package ``plot.maraca` is required as it's used in the reference index.
---
Backtrace:
1. pkgdown::build_site()
2. pkgdown:::build_site_external(pkg = pkg, examples = examples, run_dont_run = run_dont_run, …
3. callr::r(function(..., cli_colors, pkgdown_internet) { …
4. callr:::get_result(output = out, options)
5. callr:::throw(callr_remote_error(remerr))
6. callr:::callr_remote_error(remerr)
7. callr:::throw(err, parent = remerr[[3]])
---
Subprocess backtrace:
 1. pkgdown::build_site(...)
 2. pkgdown:::build_site_local(pkg = pkg, examples = examples, run_dont_run = run_dont_run, …
 3. pkgdown::build_reference(pkg, lazy = lazy, examples = examples, run_dont_run = run_dont_run, …
 4. pkgdown::build_reference_index(pkg)
 5. pkgdown::render_page(pkg, "reference-index", data = data_reference_index(pkg), …
 6. pkgdown:::render_page_html(pkg, name = name, data = data, depth = depth)
 7. utils::modifyList(data_template(pkg, depth = depth), data)
 8. base::stopifnot(is.list(x), is.list(val))
 9. pkgdown:::data_reference_index(pkg)
10. magrittr::meta %>% purrr::imap(data_reference_index_rows, pkg = pkg) %>% …
11. base::unlist(., recursive = FALSE)
12. purrr::compact(.)
13. purrr::discard(.x, function(x) is_empty(.f(x)))
14. purrr:::probe(.x, .p, ...)
15. purrr::map_lgl(.x, .p, ...)
16. purrr::imap(., data_reference_index_rows, pkg = pkg)
17. purrr::map2(.x, vec_index(.x), .f, ...)
18. local .f(.x[[1L]], .y[[1L]], ...)
19. pkgdown:::section_topics(section$contents, pkg$topics, pkg$src_path)
20. base::rbind(topics, ext_topics(ext_strings))
21. base::rbind(deparse.level, ...)
22. pkgdown:::ext_topics(ext_strings)
23. purrr::map2(pkg, fun, get_rd_from_help)
24. local .f(.x[[1L]], .y[[1L]], ...)
25. rlang::check_installed(package, "as it's used in the reference index.")
26. base::stop(cnd)
27. global (function (e) …
Execution halted
make: *** [site] Error 1

stefanoborini avatar Aug 30 '22 10:08 stefanoborini

possible fix, but not sure: if one specifies @method plot maraca::maraca it should work.

stefanoborini avatar Sep 07 '22 13:09 stefanoborini

Verified not to work with the above fix. The problem was not present in pkgdown 1.6.1, but it is present in 2.0.0

stefanoborini avatar Sep 09 '22 10:09 stefanoborini

I am running into the same error but its not because of class names... I think it has to do with @examples.

jsilve24 avatar Jan 06 '23 19:01 jsilve24

Here is (what I think should be) a reproducible example.

git clone https://github.com/jsilve24/fido.git
git checkout develop
R

then in R

pkgdown::clean_site()
pkgdown::build_site()

I have been stuck on this for the past 2 hours. I keep getting this error.

> pkgdown::clean_site()
> pkgdown::build_site()
-- Installing package into temporary library -----------------------------------
== Building pkgdown site =======================================================
Reading from: '/home/jds6696/Dropbox/Research/src/fido'
Writing to:   '/home/jds6696/Dropbox/Research/src/fido/docs'
-- Initialising site -----------------------------------------------------------
Copying '../../../../R/x86_64-pc-linux-gnu-library/4.2/pkgdown/BS5/assets/link.svg' to 'link.svg'
Copying '../../../../R/x86_64-pc-linux-gnu-library/4.2/pkgdown/BS5/assets/pkgdown.js' to 'pkgdown.js'
-
Warning message:
In utils::install.packages(pkg$src_path, repos = NULL, type = "source",  :
  installation of package ‘/home/jds6696/Dropbox/Research/src/fido’ had non-zero exit status
> pkgdown::build_site()
-- Installing package into temporary library -----------------------------------
== Building pkgdown site =======================================================
Reading from: '/home/jds6696/Dropbox/Research/src/fido'
Writing to:   '/home/jds6696/Dropbox/Research/src/fido/docs'
-- Initialising site -----------------------------------------------------------
-- Building home ---------------------------------------------------------------
Writing 'authors.html'
Writing '404.html'
-- Building function reference -------------------------------------------------
Writing 'reference/index.html'
Reading 'man/Y.Rd'
Writing 'reference/Y.html'
Reading 'man/access_dims.Rd'
Writing 'reference/access_dims.html'
Reading 'man/alr.Rd'
Writing 'reference/alr.html'
Reading 'man/alrInv.Rd'
Writing 'reference/alrInv.html'
Reading 'man/alrInv_array.Rd'
Writing 'reference/alrInv_array.html'
Reading 'man/alr_array.Rd'
Writing 'reference/alr_array.html'
Reading 'man/as.list.orthusfit.Rd'
Writing 'reference/as.list.orthusfit.html'
Reading 'man/as.list.pibblefit.Rd'
Writing 'reference/as.list.pibblefit.html'
Reading 'man/as.orthusfit.Rd'
Writing 'reference/as.orthusfit.html'
Reading 'man/as.pibblefit.Rd'
Writing 'reference/as.pibblefit.html'
Reading 'man/basset_fit.Rd'
Writing 'reference/basset_fit.html'
Reading 'man/check_dims.Rd'
Error: 
! in callr subprocess.
Caused by error in `purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, …`:
! In index: 12.
ℹ See `$stdout` for standard output.
Type .Last.error to see the more details.

The error goes away when I remove the @examples section of every one of my functions. Adding \dontrun{} doesnot make a difference. I think the bug is comming up from one of the dependencies downlit but I am not sure.

jsilve24 avatar Jan 06 '23 19:01 jsilve24

@maelle - please, are you able to share what is the likely ETA for the resolution of this?

dkarletsos avatar Mar 27 '24 13:03 dkarletsos

@dkarletsos : I'm not @maelle, but I think the fact that this issue has been sitting untouched for more than a year would suggest that it's not going to happen soon, unless you do it. So if you don't want to track down the issue and submit a PR, I'd suggest renaming your class to something that doesn't contain colons. (It appears that fido has chosen that workaround.)

dmurdoch avatar Mar 27 '24 17:03 dmurdoch

Given that there's no reprex, and it seems folks have figured our workarounds, I'm going to close this issue. If anyone really cares about it, please feel free to file a new issue accompanied by a minimal package that illustrates the problem.

hadley avatar Apr 19 '24 20:04 hadley