Science Score: 36.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
2 of 69 committers (2.9%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (15.4%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
Test coverage reports for R
Basic Info
- Host: GitHub
- Owner: r-lib
- License: other
- Language: R
- Default Branch: main
- Homepage: https://covr.r-lib.org
- Size: 9.72 MB
Statistics
- Stars: 343
- Watchers: 11
- Forks: 120
- Open Issues: 86
- Releases: 10
Topics
Metadata Files
README.md
covr 
Track test coverage for your R package and view reports locally or (optionally) upload the results to codecov or coveralls.
Installation
```r install.packages("covr")
For devel version
devtools::install_github("r-lib/covr") ```
The easiest way to setup covr on Github Actions is with usethis.
r
usethis::use_github_action("test-coverage")
Usage
For local development a coverage report can be used to inspect coverage for each line in your package. Note requires the DT package to be installed.
```r library(covr)
If run with no arguments implicitly calls package_coverage()
report() ```
covr also defines an RStudio Addin,
which runs report() on the active project. This can be used via the Addin
menu or by binding the action to a
shortcut, e.g.
Ctrl-Shift-C.
Interactively
```r
If run with the working directory within the package source.
package_coverage()
or a package in another directory
cov <- package_coverage("/dir/lintr")
view results as a data.frame
as.data.frame(cov)
zero_coverage() shows only uncovered lines.
If run within RStudio, zero_coverage() will open a marker pane with the
uncovered lines.
zero_coverage(cov) ```
Exclusions
covr supports a few of different ways of excluding some or all of a file.
.covrignore file
A .covrignore file located in your package's root directory can be used to
exclude files or directories.
The lines in the .covrignore file are interpreted as a list of file globs to
ignore. It uses the globbing rules in Sys.glob(). Any directories listed will
ignore all the files in the directory.
Alternative locations for the file can be set by the environment variable
COVR_COVRIGNORE or the R option covr.covrignore.
The .covrignore file should be added to your .RBuildignore file unless you
want to distribute it with your package. If so it can be added to
inst/.covrignore instead.
Function Exclusions
The function_exclusions argument to package_coverage() can be used to
exclude functions by name. This argument takes a vector of regular expressions
matching functions to exclude.
```r
exclude print functions
packagecoverage(functionexclusions = "print\.")
exclude .onLoad function
packagecoverage(functionexclusions = "\.onLoad") ```
Line Exclusions
The line_exclusions argument to package_coverage() can be used to exclude some or
all of a file. This argument takes a list of filenames or named ranges to
exclude.
```r
exclude whole file of R/test.R
packagecoverage(lineexclusions = "R/test.R")
exclude lines 1 to 10 and 15 from R/test.R
packagecoverage(lineexclusions = list("R/test.R" = c(1:10, 15)))
exclude lines 1 to 10 from R/test.R, all of R/test2.R
packagecoverage(lineexclusions = list("R/test.R" = c(1, 10), "R/test2.R")) ```
Exclusion Comments
In addition you can exclude lines from the coverage by putting special comments in your source code.
This can be done per line.
r
f1 <- function(x) {
x + 1 # nocov
}
Or by specifying a range with a start and end.
r
f2 <- function(x) { # nocov start
x + 2
} # nocov end
The patterns used can be specified by setting the global options
covr.exclude_pattern, covr.exclude_start, covr.exclude_end.
NB: The same pattern applies to exclusions in the src folder, so skipped lines in, e.g., C code (where comments can start with //) should look like // # nocov.
FAQ
Will covr work with testthat, RUnit, etc...
Covr should be compatible with any testing package, it uses
tools::testInstalledPackage() to run your packages tests.
Will covr work with alternative compilers such as ICC
Covr now supports Intel's icc compiler, thanks to work contributed by Qin
Wang at Oracle.
Covr is known to work with clang versions 3.5+ and gcc version 4.2+.
If the appropriate gcov version is not on your path you can set the appropriate
location with the covr.gcov options. If you set this path to "" it will turn
off coverage of compiled code.
r
options(covr.gcov = "path/to/gcov")
How does covr work?
covr tracks test coverage by modifying a package's code to add tracking calls
to each call.
The vignette vignettes/howitworks.Rmd contains a detailed explanation of the technique and the rationale behind it.
You can view the vignette from within R using
r
vignette("how_it_works", package = "covr")
Why can't covr run during R CMD check
Because covr modifies the package code it is possible there are unknown edge cases where that modification affects the output. In addition when tracking coverage for compiled code covr compiles the package without optimization, which can modify behavior (usually due to package bugs which are masked with higher optimization levels).
Alternative Coverage Tools
- https://github.com/MangoTheCat/testCoverage (no longer supported)
- R-coverage (no longer supported)
Code of Conduct
Please note that the covr project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.
Owner
- Name: R infrastructure
- Login: r-lib
- Kind: organization
- Repositories: 154
- Profile: https://github.com/r-lib
GitHub Events
Total
- Create event: 8
- Issues event: 27
- Watch event: 9
- Delete event: 1
- Member event: 1
- Issue comment event: 64
- Push event: 49
- Pull request review comment event: 36
- Pull request review event: 36
- Pull request event: 29
- Fork event: 9
Last Year
- Create event: 8
- Issues event: 27
- Watch event: 9
- Delete event: 1
- Member event: 1
- Issue comment event: 64
- Push event: 49
- Pull request review comment event: 36
- Pull request review event: 36
- Pull request event: 29
- Fork event: 9
Committers
Last synced: 8 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Jim Hester | j****r@g****m | 818 |
| Kirill Müller | k****r@i****h | 44 |
| dgkf | 1****f | 39 |
| chinqw | q****g@o****m | 27 |
| hb | hb@a****g | 21 |
| Tomasz Kalinowski | t****z@p****o | 20 |
| Karl Forner | k****r@q****o | 15 |
| stevepeak | s****e@s****t | 14 |
| Kirill Sevastyanenko | k****a@g****m | 11 |
| Jon Clayden | c****e@c****g | 9 |
| Robert Flight | r****9@g****m | 8 |
| Michael Chirico | m****4@g****m | 7 |
| Hadley Wickham | h****m@g****m | 6 |
| olivroy | 5****y | 5 |
| Kun Ren | m****l@r****e | 4 |
| Eric N. Brown | e****n@g****m | 4 |
| Mara Averick | m****k@g****m | 4 |
| mb706 | m****r@c****e | 4 |
| brodieG | b****G | 3 |
| Kevin Ushey | k****y@g****m | 3 |
| Gábor Csárdi | c****r@g****m | 3 |
| Jouni Helske | j****e@j****i | 2 |
| Gergely Daróczi | d****g@r****t | 2 |
| James Lamb | j****0@g****m | 2 |
| Karl Forner | k****r@g****m | 2 |
| Kirill Müller | k****r@m****g | 2 |
| Markus Wamser | g****v@m****u | 2 |
| Patrick Perry | p****y@g****m | 2 |
| wligtenberg | w****g@o****u | 2 |
| RobertZK | t****b@g****m | 2 |
| and 39 more... | ||
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 121
- Total pull requests: 68
- Average time to close issues: 4 months
- Average time to close pull requests: 3 months
- Total issue authors: 83
- Total pull request authors: 28
- Average comments per issue: 2.25
- Average comments per pull request: 2.38
- Merged pull requests: 46
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 19
- Pull requests: 28
- Average time to close issues: 20 days
- Average time to close pull requests: 21 days
- Issue authors: 9
- Pull request authors: 7
- Average comments per issue: 0.53
- Average comments per pull request: 1.57
- Merged pull requests: 16
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- hadley (10)
- MichaelChirico (7)
- dgkf (7)
- MLopez-Ibanez (4)
- daattali (3)
- gaborcsardi (3)
- jimhester (3)
- tdhock (2)
- mpadge (2)
- mccroweyclinton-EPA (2)
- jennybc (2)
- krassowski (2)
- thisisnic (2)
- billdenney (2)
- Ahill25 (2)
Pull Request Authors
- MichaelChirico (13)
- dgkf (10)
- hadley (9)
- olivroy (8)
- t-kalinowski (6)
- gergness (4)
- krlmlr (3)
- jimhester (3)
- maksymiuks (2)
- gaborcsardi (2)
- siddharthab (2)
- kevinushey (2)
- hsloot (1)
- radbasa (1)
- kyleam (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 3
-
Total downloads:
- cran 167,145 last-month
- Total docker downloads: 2,799,053
-
Total dependent packages: 2,520
(may contain duplicates) -
Total dependent repositories: 7,211
(may contain duplicates) - Total versions: 49
- Total maintainers: 1
cran.r-project.org: covr
Test Coverage for Packages
- Homepage: https://covr.r-lib.org
- Documentation: http://cran.r-project.org/web/packages/covr/covr.pdf
- License: MIT + file LICENSE
-
Latest release: 3.6.4
published over 2 years ago
Rankings
Maintainers (1)
proxy.golang.org: github.com/r-lib/covr
- Documentation: https://pkg.go.dev/github.com/r-lib/covr#section-documentation
- License: other
-
Latest release: v3.6.3+incompatible
published over 2 years ago
Rankings
conda-forge.org: r-covr
- Homepage: https://github.com/r-lib/covr
- License: GPL-3.0-only
-
Latest release: 3.6.1
published over 3 years ago
Rankings
Dependencies
- actions/checkout v3 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
- JamesIves/github-pages-deploy-action v4.4.1 composite
- actions/checkout v3 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
- actions/checkout v3 composite
- r-lib/actions/pr-fetch v2 composite
- r-lib/actions/pr-push v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
- actions/checkout v3 composite
- actions/upload-artifact v3 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
- R >= 3.1.0 depends
- methods * depends
- crayon * imports
- digest * imports
- httr * imports
- jsonlite * imports
- rex * imports
- stats * imports
- utils * imports
- withr >= 1.0.2 imports
- yaml * imports
- DT >= 0.2 suggests
- R6 * suggests
- covr * suggests
- curl * suggests
- htmltools * suggests
- knitr * suggests
- memoise * suggests
- mockery * suggests
- parallel * suggests
- rlang * suggests
- rmarkdown * suggests
- rstudioapi >= 0.2 suggests
- testthat * suggests
- xml2 >= 1.0.0 suggests
- R >= 3.1.2 depends
- testthat * suggests
- R >= 3.1.2 depends
- testthat * suggests
- R >= 3.1.2 depends
- testthat * suggests
- R >= 3.1.2 depends
- R >= 3.1.2 depends
- testthat * suggests
- R >= 3.1.2 depends
- testthat * suggests
- R >= 3.1.2 depends
- parallel * suggests
- R >= 3.1.2 depends
- R >= 3.1.2 depends
- R6 * imports
- testthat * suggests
- R >= 3.1.2 depends
- testthat * suggests
- R >= 3.1.2 depends
- R >= 3.1.2 depends
- R >= 3.1.2 depends
- testthat * suggests
- rocker/hadleyverse latest build