r-lib / covr
Showing 1 of 1 files from the diff.

@@ -103,32 +103,34 @@
Loading
103 103
  for (i in seq_along(x)) {
104 104
    src_file <- attr(x[[i]]$srcref, "srcfile")
105 105
    filename <- filenames[[i]]
106 -
    if (is.null(res[[filename]])) {
107 -
      lines <- getSrcLines(src_file, 1, Inf)
108 -
      matches <- rex::re_matches(lines,
109 -
        rex::rex(start, any_spaces, "#line", spaces,
110 -
          capture(name = "line_number", digit), spaces,
111 -
          quotes, capture(name = "filename", anything), quotes))
112 -
113 -
      matches <- na.omit(matches)
114 -
115 -
      filename_match <- which(matches$filename == src_file$filename)
116 -
117 -
      if (length(filename_match) == 1) {
118 -
        start <- as.numeric(rownames(matches)[filename_match]) + 1
119 -
        end <- if (!is.na(rownames(matches)[filename_match + 1])) {
120 -
          as.numeric(rownames(matches)[filename_match + 1]) - 1
121 -
        } else {
122 -
          length(lines)
123 -
        }
106 +
107 +
    if (filename == "") next
108 +
    if (!is.null(res[[filename]])) next
109 +
110 +
    lines <- getSrcLines(src_file, 1, Inf)
111 +
    matches <- rex::re_matches(lines,
112 +
      rex::rex(start, any_spaces, "#line", spaces,
113 +
        capture(name = "line_number", digit), spaces,
114 +
        quotes, capture(name = "filename", anything), quotes))
115 +
116 +
    matches <- na.omit(matches)
117 +
118 +
    filename_match <- which(matches$filename == src_file$filename)
119 +
120 +
    if (length(filename_match) == 1) {
121 +
      start <- as.numeric(rownames(matches)[filename_match]) + 1
122 +
      end <- if (!is.na(rownames(matches)[filename_match + 1])) {
123 +
        as.numeric(rownames(matches)[filename_match + 1]) - 1
124 124
      } else {
125 -
        start <- 1
126 -
        end <- length(lines)
125 +
        length(lines)
127 126
      }
128 -
      src_file$file_lines <- lines[seq(start, end)]
129 -
130 -
      res[[filename]] <- src_file
127 +
    } else {
128 +
      start <- 1
129 +
      end <- length(lines)
131 130
    }
131 +
    src_file$file_lines <- lines[seq(start, end)]
132 +
133 +
    res[[filename]] <- src_file
132 134
  }
133 135
  res
134 136
}
Files Coverage
R 78.07%
src/reassign.c 100.00%
Project Totals (28 files) 78.26%
1
comment: false
2

3
coverage:
4
  status:
5
    project:
6
      default:
7
        target: auto
8
        threshold: 1%
9
        informational: true
10
    patch:
11
      default:
12
        target: auto
13
        threshold: 1%
14
        informational: true
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading