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

Fix trailing comma in glue function #151

Closed
wants to merge 1 commit into from
Closed

Conversation

froggleston
Copy link
Contributor

This PR attempts to fix a bug introduced in R >=4.3.3 where glue::glue() errors if there are trailing commas, i.e. null arguments. Raised in #149, tidyverse/glue#320, and culprit found by Hugo Gruson in the ROpenSci Slack:

pegboard/R/fix_links.R

Lines 119 to 121 in 1bc5753

destination <- glue::glue(
".//{ns}{asis_nodes}/following-sibling::{ns}text[{predicate}]",
)

> library(knitr)
> library(rmarkdown)
> pandoc::pandoc_activate("3.1.11")
✔ Version '3.1.11' is now the active one.
ℹ Pandoc version also activated for rmarkdown functions.
> devtools::install
devtools::install_git        devtools::install_cran       devtools::install_gitlab     devtools::install_bioc
devtools::install_local      devtools::install_deps       devtools::install_svn        devtools::install
devtools::install_bitbucket  devtools::install_version    devtools::install_dev_deps
devtools::install_url        devtools::install_dev        devtools::install_github
> devtools::install_github("carpentries/sandpaper@8092d0368b790a4bf6a1390c21c6dd63d1779ab6")
Downloading GitHub repo carpentries/sandpaper@8092d0368b790a4bf6a1390c21c6dd63d1779ab6
── R CMD build ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
✔  checking for file ‘/tmp/RtmpY8F0K8/remotesec63a37e999/carpentries-sandpaper-8092d03/DESCRIPTION’ ...
─  preparing ‘sandpaper’:
✔  checking DESCRIPTION meta-information ...
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
   Omitted ‘LazyData’ from DESCRIPTION
─  building ‘sandpaper_0.16.2.tar.gz’

Installing package into ‘/home/froggleston/R/x86_64-pc-linux-gnu-library/4.3’
(as ‘lib’ is unspecified)
* installing *source* package ‘sandpaper’ ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (sandpaper)
> library(sandpaper)
> rcmdcheck::rcmdcheck(".")
── R CMD build ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
pdflatex not found! Not building PDF manual.
✔  checking for file ‘.../DESCRIPTION’ ...
─  preparing ‘sandpaper’:
✔  checking DESCRIPTION meta-information ...
─  installing the package to build vignettes
E  creating vignettes (3.6s)
   --- re-building ‘automated-pull-requests.Rmd’ using rmarkdown
   --- finished re-building ‘automated-pull-requests.Rmd’

   --- re-building ‘building-with-renv.Rmd’ using rmarkdown
   --- finished re-building ‘building-with-renv.Rmd’

   --- re-building ‘data-flow.Rmd’ using rmarkdown

   Quitting from lines 271-274 [validate] (data-flow.Rmd)
   Error: processing vignette 'data-flow.Rmd' failed with diagnostics:
   ℹ In index: 1.
   ℹ With name: introduction.md.
   Caused by error:
   ! argument "..2" is missing, with no default
   --- failed re-building ‘data-flow.Rmd’

   --- re-building ‘include-child-documents.Rmd’ using rmarkdown

   Quitting from lines 11-42 [setup] (include-child-documents.Rmd)
   Error: processing vignette 'include-child-documents.Rmd' failed with diagnostics:
   argument "..2" is missing, with no default
   --- failed re-building ‘include-child-documents.Rmd’

   --- re-building ‘translations.Rmd’ using rmarkdown
   --- finished re-building ‘translations.Rmd’

   SUMMARY: processing the following files failed:
     ‘data-flow.Rmd’ ‘include-child-documents.Rmd’

   Error: Vignette re-building failed.
   Execution halted
Stacktrace
> rlang::last_trace()
<error/purrr_error_indexed>
Error in `purrr::map()`:
ℹ In index: 1.
ℹ With name: introduction.md.
Caused by error:
! argument "..2" is missing, with no default
---
Backtrace:

  1. ├─base::system.time(validate_lesson(lsn))
  2. └─sandpaper::validate_lesson(lsn)
  3.   └─sandpaper:::this_lesson(path)
  4.     └─.store$set(path)
  5.       └─pegboard::Lesson$new(path, jekyll = FALSE)
  6.         └─pegboard (local) initialize(...)
  7.           └─pegboard:::read_sandpaper_lesson(path, ...)
  8.             └─pegboard:::read_markdown_files(...)
  9.               └─purrr::map(.x = the_files, .f = Episode$new, ...)
 10.                 └─purrr:::map_("list", .x, .f, ..., .progress = .progress)
 11.                   ├─purrr:::with_indexed_errors(...)
 12.                   │ └─base::withCallingHandlers(...)
 13.                   ├─purrr:::call_with_cleanup(...)
 14.                   └─R6 (local) .f(.x[[i]], ...)
 15.                     └─pegboard (local) initialize(...)
 16.                       └─pegboard:::fix_links(ep$body)
 17.                         └─pegboard:::find_broken_links(body)
 18.                           ├─xml2::xml_find_all(body, make_link_patterns(), ns = get_ns())
 19.                           ├─xml2:::xml_find_all.xml_node(body, make_link_patterns(), ns = get_ns())
 20.                           └─pegboard:::make_link_patterns()
 21.                             └─glue::glue(...)
 22.                               └─glue::glue_data(...)
 23.                                 └─base::lapply(...)
 24.                                   └─glue (local) FUN(X[[i]], ...)
 25.                                     ├─eval(call("force", as.symbol(paste0("..", x)))) %||% .null
 26.                                     ├─base::eval(call("force", as.symbol(paste0("..", x))))
 27.                                     │ └─base::eval(call("force", as.symbol(paste0("..", x))))
 28.                                     └─base::force(..2)
Run rlang::last_trace(drop = FALSE) to see 4 hidden frames.
> pegboard:::make_link_patterns()
Error in eval(call("force", as.symbol(paste0("..", x)))) :
  argument "..2" is missing, with no default

@froggleston
Copy link
Contributor Author

Duplicate of #150

@froggleston froggleston marked this as a duplicate of #150 Mar 5, 2024
@froggleston froggleston closed this Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant