Compare 6542c4e ... +6 ... 4be1fd0

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.

Showing 1 of 13 files from the diff.
Other files ignored by Codecov
man/withr.Rd has changed.
man/with_dir.Rd has changed.
DESCRIPTION has changed.
R/dir.R has changed.
NEWS.md has changed.
revdep/README.md has changed.
cran-comments.md has changed.
README.Rmd has changed.
README.md has changed.

@@ -4,6 +4,9 @@
Loading
4 4
#' @template with
5 5
#' @param new `[character vector]`\cr (Deprecated for `local_tempfile()`) Names of temporary file handles to create.
6 6
#' @param envir `[environment]`\cr Environment in which to define the temporary files.
7 +
#' @param clean `[logical(1)]`\cr A logical indicating if the temporary
8 +
#'   directory should be deleted after use (`TRUE`, default) or left alone (`FALSE`).
9 +
#' @inheritParams with_collate
7 10
#' @inheritParams base::tempfile
8 11
#' @examples
9 12
#' # check how big iris would be if written as csv vs RDS
@@ -41,3 +44,40 @@
Loading
41 44
  }
42 45
  defer(unlink(mget(new, envir = envir), recursive = TRUE), envir = envir)
43 46
}
47 +
48 +
49 +
#' @rdname with_tempfile
50 +
#' @export
51 +
with_tempdir <- function(code, clean = TRUE,
52 +
  pattern = "file", tmpdir = tempdir(), fileext = "") {
53 +
  if (length(clean) > 1 || !is.logical(clean)) {
54 +
    stop("`clean` must be a single TRUE or FALSE", call. = FALSE)
55 +
  }
56 +
57 +
  tmp <- tempfile(pattern = pattern, tmpdir = tmpdir, fileext = fileext)
58 +
59 +
  dir.create(tmp)
60 +
  if (clean) {
61 +
    on.exit(unlink(tmp, recursive = TRUE), add = TRUE)
62 +
  }
63 +
  withr::with_dir(tmp, code)
64 +
}
65 +
66 +
#' @rdname with_tempfile
67 +
#' @export
68 +
local_tempdir <- function(pattern = "file", tmpdir = tempdir(),
69 +
                          fileext = "", .local_envir = parent.frame(), clean = TRUE) {
70 +
  if (length(clean) > 1 || !is.logical(clean)) {
71 +
    stop("`clean` must be a single TRUE or FALSE", call. = FALSE)
72 +
  }
73 +
74 +
  path <- tempfile(pattern = pattern, tmpdir = tmpdir, fileext = fileext)
75 +
76 +
  dir.create(path, recursive = TRUE)
77 +
78 +
  if (isTRUE(clean)) {
79 +
    defer(unlink(path, recursive = TRUE), envir = .local_envir)
80 +
  }
81 +
82 +
  path
83 +
}

Everything is accounted for!

No changes detected that need to be reviewed.
What changes does Codecov check for?
Lines, not adjusted in diff, that have changed coverage data.
Files that introduced coverage data that had none before.
Files that have missing coverage data that once were tracked.
Files Coverage
R 84.97%
Project Totals (22 files) 84.97%
Loading