hafen / trelliscopejs

Compare e2f2640 ... +6 ... e1b2df7

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 2 of 3 files from the diff.
Newly tracked file
R/abs-path-checking.R created.
Other files ignored by Codecov
DESCRIPTION has changed.

@@ -0,0 +1,28 @@
Loading
1 +
# The following code was taken directly from the {xfun} package. It is
2 +
# licensed under the MIT license. The copyright holder is Yihui Xie.
3 +
# See https://github.com/yihui/xfun for the package and details.
4 +
5 +
is_abs_path <- function (x) {
6 +
    if (is_unix())
7 +
        grepl("^[/~]", x)
8 +
    else !same_path(x, file.path(".", x))
9 +
}
10 +
11 +
same_path <- function (p1, p2, ...) {
12 +
    normalize_path(p1, ...) == normalize_path(p2, ...)
13 +
}
14 +
15 +
normalize_path <- function (x, winslash = "/", must_work = FALSE) {
16 +
    res = normalizePath(x, winslash = winslash, mustWork = must_work)
17 +
    if (is_windows())
18 +
        res[is.na(x)] = NA
19 +
    res
20 +
}
21 +
22 +
is_windows <- function () {
23 +
  .Platform$OS.type == "windows"
24 +
}
25 +
26 +
is_unix <- function () {
27 +
  .Platform$OS.type == "unix"
28 +
}

@@ -44,9 +44,10 @@
Loading
44 44
45 45
is_in_shiny <- function() {
46 46
  res <- FALSE
47 -
  tmp <- try(utils::getFromNamespace(".globals", "shiny")$running, silent = TRUE)
48 -
  if (!inherits(tmp, "try-error"))
49 -
    res <- tmp
47 +
  tmp <- try(utils::getFromNamespace(".globals", "shiny")$appState,
48 +
    silent = TRUE)
49 +
  if (!inherits(tmp, "try-error") && !is.null(tmp))
50 +
    res <- TRUE
50 51
  res
51 52
}
52 53
@@ -101,8 +102,9 @@
Loading
101 102
  # if outside knitr, config.jsonp will always be available to index.html inside appfiles
102 103
  config_path <- paste0("appfiles/config.json", ifelse(jsonp, "p", ""))
103 104
  if (in_knitr || in_shiny && !self_contained) {
104 -
    if (!grepl("^[A-Za-z0-9_]", orig_path))
105 +
    if (is_abs_path(orig_path)) {
105 106
      stop_nice("Path for trelliscope output while inside knitr or Shiny must be relative.")
107 +
    }
106 108
    if (in_shiny) {
107 109
      if (!grepl("^www/", orig_path))
108 110
        stop_nice("Path for trelliscope output while inside Shiny must go inside www/...")

Learn more Showing 1 files with coverage changes found.

New file R/abs-path-checking.R
New
Loading file...
Files Coverage
R -0.52% 72.83%
Project Totals (12 files) 72.83%
Loading