Expose cache_dir on fn_graph() to keep checks out of ~/.cache#32
Merged
Conversation
fn_graph() called symbols(project_dir) without a cache_dir, so its example and the matching tinytest wrote to the user's persistent cache (~/.cache/R/saber/symbols/<basename>.rds). That triggered CRAN's 'checking for new files in some other directories' NOTE on packages that exercise fn_graph during R CMD check, and on saber itself when the example runs. Add cache_dir as an exposed parameter mirroring blast_radius() and symbols(), forward it to symbols(), and update the example + test to pass tempdir(). The default is unchanged for callers that omit it, so existing usage keeps working.
… work Inserting cache_dir between include_external and ... broke existing positional callers: fn_graph(d, FALSE, 900) used to forward 900 into graph_svg(...) but would now bind it to cache_dir and fail in symbols(). Putting cache_dir after ... makes it name-only, which matches base R convention (paste's sep/collapse, c's recursive, etc.) and preserves positional forwarding for graph_svg.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
`fn_graph()` called `symbols(project_dir)` without a `cache_dir` argument, so its example (`man/fn_graph.Rd`) and matching tinytest (`inst/tinytest/test_fn_graph.R`) both wrote to the user's persistent cache during R CMD check:
CRAN flags this with the checking for new files in some other directories NOTE. The same path was contributing to the downstream NOTE on corteza (https://www.stats.ox.ac.uk/pub/bdr/donttest/corteza.out).
Fix
Expose `cache_dir` as a parameter on `fn_graph()` mirroring the existing pattern in `blast_radius()` and `symbols()`:
```r
fn_graph <- function(project_dir, include_external = FALSE,
cache_dir = file.path(tools::R_user_dir("saber", "cache"), "symbols"),
...) {
idx <- symbols(project_dir, cache_dir = cache_dir)
...
}
```
Default is unchanged, so existing callers keep working. Example and test now pass `cache_dir = tempdir()`.
Verification
```
$ Rscript --vanilla tests/tinytest.R
All ok, 150 results (0.1s)
$ r -e 'tinypkgr::check()'
saber 0.7.1: 0 error(s), 0 warning(s), 0 note(s)
$ find ~/.cache/R/saber -type f -newer R/fn_graph.R
(no output)
```
`fn_graph` has zero in-repo callers per `saber::blast_radius("fn_graph", project = ".")`, so the signature addition is safe.