Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

percent_coverage is broken or inadequately documented #384

Closed
jpritikin opened this issue Jul 26, 2019 · 4 comments
Closed

percent_coverage is broken or inadequately documented #384

jpritikin opened this issue Jul 26, 2019 · 4 comments
Labels
reprex needs a minimal reproducible example

Comments

@jpritikin
Copy link
Contributor

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

@jimhester
Copy link
Member

Could you exhibit the issues on a simpler package? I cannot observe the issue unless I can install the package locally, and I do not have the time to deal with installation issues trying to get OpenMX installed on my machine.

@jimhester jimhester added the reprex needs a minimal reproducible example label Jul 27, 2019
@jpritikin
Copy link
Contributor Author

How about I save the output of covr::package_coverage (c1 above) as an rda and attach it somewhere? The question is why covr:::per_line and percent_coverage process the same information differently, yes?

@jpritikin
Copy link
Contributor Author

Can you download from here?

@jpritikin
Copy link
Contributor Author

Please confirm that you have everything you need to debug this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reprex needs a minimal reproducible example
Projects
None yet
Development

No branches or pull requests

2 participants