rmarkdown icon indicating copy to clipboard operation
rmarkdown copied to clipboard

Implicit dependency on config.yml not detected

Open jmcphers opened this issue 7 years ago • 1 comments
trafficstars

Repro

First, create the following R Markdown document and save it as config.Rmd.

---
title: "Config"
output: html_document
---

```{r}
config::get()
```

Next, add a config.yml file in the same folder.

Finally, run the following at the R console:

rmarkdown::find_external_resources("~/rmd/config.Rmd")

Expected result

The config.yml file should be returned.

Actual result

No results are returned.

The get() function accepts a config filename. If this filename is specified explicitly, as in:

config::get("foo.yml")

then the string-based filename finder will find it. However, because we only skim R strings for filenames, a filename supplied in a default argument value won't be discovered.

This ordinarily wouldn't be a big deal (and we probably don't need to worry about it for most arguments), but it's significant in this instance because find_external_resources is used to ascertain the set of files that need to be published, and config.yml is an important dependency.

jmcphers avatar Apr 27 '18 19:04 jmcphers

I think a mechanism for third-party package authors to "register" their dependencies in rmarkdown will be much easier than we actively analyzing their code for potential dependencies. I guess the latter can never be bullet-proof.

yihui avatar Jun 25 '18 22:06 yihui