Wiki

Clone wiki

bio3d / How to check the bio3d package

We recommend use the script check.bio3d.R, under new_funs of this repository, to check the bio3d package at all levels. Other options are the devtools package (devtools::check(), devtools::run_examples(), etc) and the conventional R CMD check.

Basic checking for CRAN submission

To keep bio3d alive on CRAN, we should do such checking before every release of a new version and make sure there is no any error, warning, or critical note.

##Step 1. Prepare environment to do the checking The checking should be performed with at least three different R builds, i.e. R-current-release, R-devel and R-patched, and be done under at least three types of OS (Linux, Mac OS, and Windows). We can use win-builder (http://win-builder.r-project.org/) for checking under Windows environment.

Optionally, we can test on R-old-releases, but remember that bio3d is dependent on R version >= 3.1.0.

##Step 2. Prepare the bio3d tarball file Check out the master branch (use git checkout master). Make sure you have all your source files updated (use git pull to get synchronized with the bitbucket repository) and all your changes committed and pushed (use git status, git commit and git push). IMPORTANT: refer to the wiki if you are not familiar or forget git commands!

Under ver_devel/, type

#!r 
R CMD build bio3d
It will produce a file named 'bio3d_x.x-x.tar.gz', where 'x.x-x' is the version number of the package (See this page for our versioning guidelines). Always use this file for any kind of checking/testing.

##Step 3. Check the package In an R session, input following commands to check the package:

#!r
source("new_funs/check.bio3d.R")
check.bio3d("bio3d_x.x-x.tar.gz")

Fix all (if any) reported errors, warnings, and notes, and repeat this step until none of them appears. It is possible to leave some notes but we should be very careful to do that. With our own practice, most notes are related to bugs in examples in Rd files, improper coding styles, bad documentation, etc, which should be fixed.

Regular checking for daily maintenance

We should frequently do such checking during the period of development. A good practice is doing it every time we push to bitbucket (To be updated: we are on the way to automate this process). As a compromise, checking can be performed under just one environment, e.g. R-devel + Linux.

#!r
check.bio3d("bio3d_x.x-x.tar.gz", run.skipcran = TRUE, run.donttest = TRUE)

In the above command, run.skipcran=TRUE turns on running all the tests written under 'bio3d/tests/testthat' (In 'basic checking', some tests are skipped to speed up the checking), and run.donttest=TRUE turns on checking for example codes embraced in "\donttest{}" block.

Extensive checking for HTML documentation generation

An extensive checking will do all those checks done in 'regular checking' plus executing example codes embraced by "\dontrun{}". It will be performed before generating HTML documentation files (usually before the release of a new version). Ideally, we could do the checking by following command:

#!r
check.bio3d("bio3d_x.x-x.tar.gz", run.skipcran = TRUE, run.donttest = TRUE, run.dontrun = TRUE)

However, it is already known that in some Rd files '\dontrun{}' block is not designed to be executable. The function 'check.bio3d()' doesn't support skipping these files yet. To go through all examples, alternatively we can use the devtools function run_examples():

#!r
devtools::run_examples("bio3d", start = "XX", test = FALSE, run = FALSE)
Note that you need to unpack 'bio3d_x.x-x.tar.gz' first and provide the extracted folder name, 'bio3d', in above command. The option start="XX" is very useful: The checking will start from the Rd file "XX.Rd" (e.g. "rmsd") and skip all files before it by a lexicographically order. With this option, you don't need to restart from the beginning everytime you find and fix a bug, which eases the checking substantially.

Updated