Contributing
Source:CONTRIBUTING.md
Bug reports
Please provide a minimal reproducible example if applicable and depending on the severity of the bug (typo vs crash) also your sessionInfo()
.
Pull requests
Please create an issue first. After that, make sure that CRAN check passes, adhere to the general code style and create tests if you add new functionality.
Scientific collaboration
Always welcome (but the ability to do so may depend on the number of current ongoing projects), be sure to reach out via mail or in an issue.
Notes for developers
Note that this package includes C++
code. To build it, you need a functioning compiler toolchain (RTools on windows).
Code style
Functions, parameter and variables are in snake_case
, classes are in CamelCase
. Note the .lintr
file for R
code and .clang-format
file for the c++
code. Also, the very helpful command:
styler::style_pkg(
scope = "line_breaks",
strict = TRUE,
indent_by = 4L
)
Make sure nothing breaks when making changes
Rcpp::compileAttributes()
devtools::document()
library(tinytest)
devtools::load_all()
# Enable extensive reporting from metaRange functions when testing
set_verbosity(2)
# quick tests; suitable for CRAN and the CI
tinytest::test_all()
# A longer a bit more extensive test; suitable for local testing
tinytest::test_all(testdir = "inst/local")
# test that examples work without problems
options(warn = 2)
devtools::run_examples()
# and lastly the R CMD check
devtools::check()
Compiled code troubleshooting
devtools::document()
and devtools::load_all()
don’t perform a standard install (they set special compile flags) and may cause the intermediate dlls to crash on error in some environments (specifically vscode). If there are any problems, try pkgbuild::clean_dll()
and build again or test with an installed version via devtools::install()
.
Vignettes
Build a vignette for testing purposes (don’t forget to delete the html afterwards).
devtools::build_rmd("vignettes/[vignette_name].Rmd")
# or if this ^ doesn't work:
rmarkdown::render("vignettes/[vignette_name].Rmd")
Calculate test coverage:
covr::package_coverage(type = "all")
Docs / pkgdown
Build the site.
pkgdown::build_site(seed = 3)
Check the html files manually or start a local server to preview the site with working js (search ect.).
servr::httw("docs")
Release process
- Run extensive checks:
devtools::check(
incoming = TRUE,
remote = TRUE
)
Update News and Description.
If it has been a year since the last (CRAN) release, update the copyright header (add current year).
Make sure the links are ok.
urlchecker::url_check()
- Check the spelling.
spelling::spell_check_package()
Make sure to keep in mind: https://github.com/DavisVaughan/extrachecks
Test the package on r-hub with valgrind / sanitizers for potential memory issues. https://devtools.r-lib.org/reference/check_rhub.html
Update cran-comments
Follow: https://r-pkgs.org/release.html#sec-release-process I.e:
devtools::submit_cran()
usethis::use_github_release()