-
Notifications
You must be signed in to change notification settings - Fork 121
Closed
Labels
reprexneeds a minimal reproducible exampleneeds a minimal reproducible example
Description
Following up on #374 and my call for community help, I did a bit more research. On my local machine, I ran:
library(devtools)
devtools::install_github("jpritikin/covr") # based on 1.2.0-520-ge344676
library(covr)
library(roxygen2)
library(withr)
options(covr.gcov = "gcov-9")
withr::with_envvar(c(MAKE="make -j4"), {
withr::with_makevars(getOption("covr.flags"), assignment = "+=", {
utils::install.packages(
".", repos = NULL, type = "source",
INSTALL_opts = c("--example", "--install-tests", "--with-keep.source",
"--with-keep.parse.data", "--no-multiarch")
)
})
})
roxygenize('.', roclets=c('rd'))
c1 <- covr::package_coverage(type=c("tests","examples"), quiet=TRUE, pre_clean=FALSE)
pl <- covr:::per_line(c1)
s1 <- (t(sapply(pl, function(x) c(total=length(x$coverage),
possible=sum(!is.na(x$coverage)),
covered=sum(!is.na(x$coverage) & x$coverage > 0)))))
s1 <- as.data.frame(s1)
s1$pending = s1$possible - s1$covered
t1 <- colSums(s1[,2:4])
t1['covered'] / t1['possible']
From this last division, I obtained 0.4412056 which is very close to a recent commit on codecov. This number looks good. However, when I do,
percent_coverage(c1, by="line")
percent_coverage(c1, by="expression")
then I get numbers that don't make sense. I get 56.75 (by line) and 57.3 (by expression). I guess I could forget about percent_coverage and just use covr:::per_line. However, this API is not exported. Please suggest how I might proceed.
Thank you
Metadata
Metadata
Assignees
Labels
reprexneeds a minimal reproducible exampleneeds a minimal reproducible example