Dan Chaltiel
Dan Chaltiel

Reputation: 8494

How to devtools::check() a package for one specific step only?

devtools::check() is a wonderful tool, but it can take a lot of time on big packages.

If I have an error in one step, I often would like to check this step only, without having to compute all the previous ones.

For instance, I have this annoying no visible binding for global variable 'xxx' note when running the checking R code for possible problems step. I'm not sure which call of xxx is causing the note, so I would love to run only this step.

On this particular matter, I tried codetools::checkUsagePackage("mypackage") but there are far too many false positives so that is not CRAN-like.

Is there any way to run a single step of devtools::check() at a time?

Upvotes: 1

Views: 1232

Answers (1)

Anders Ellern Bilgrau
Anders Ellern Bilgrau

Reputation: 10223

Only a partial answer. You can set some of the arguments of devtools::check to FALSE to skip some specific checks/parts and you can also pass arguments to the underlying R CMD check (via args) to skip even more.

Have a look at the R CMD check utility help for the parameters you can pass to it:

$ R CMD check --help
Usage: R CMD check [options] pkgs

Check R packages from package sources, which can be directories or
package 'tar' archives with extension '.tar.gz', '.tar.bz2',
'.tar.xz' or '.tgz'.

A variety of diagnostic checks on directory structure, index and
control files are performed.  The package is installed into the log
directory and production of the package PDF manual is tested.
All examples and tests provided by the package are tested to see if
they run successfully.  By default code in the vignettes is tested,
as is re-building the vignette PDFs.

Options:
  -h, --help       print short help message and exit
  -v, --version        print version info and exit
  -l, --library=LIB     library directory used for test installation
           of packages (default is outdir)
  -o, --output=DIR      directory for output, default is current directory.
           Logfiles, R output, etc. will be placed in 'pkg.Rcheck'
           in this directory, where 'pkg' is the name of the
           checked package
      --no-clean        do not clean 'outdir' before using it
      --no-codoc        do not check for code/documentation mismatches
      --no-examples     do not run the examples in the Rd files
      --no-install      skip installation and associated tests
      --no-tests        do not run code in 'tests' subdirectory
      --no-manual       do not produce the PDF manual
      --no-vignettes    do not run R code in vignettes nor build outputs
      --no-build-vignettes    do not build vignette outputs
      --ignore-vignettes    skip all tests on vignettes
      --run-dontrun     do run \dontrun sections in the Rd files
      --run-donttest    do run \donttest sections in the Rd files
      --use-gct         use 'gctorture(TRUE)' when running examples/tests
      --use-valgrind    use 'valgrind' when running examples/tests/vignettes
      --timings         record timings for examples
      --install-args=   command-line args to be passed to INSTALL
      --test-dir=       look in this subdirectory for test scripts (default tests)
      --no-stop-on-test-error   do not stop running tests after first error
      --check-subdirs=default|yes|no
           run checks on the package subdirectories
           (default is yes for a tarball, no otherwise)
      --as-cran         select customizations similar to those used
                        for CRAN incoming checking

The following options apply where sub-architectures are in use:
      --extra-arch      do only runtime tests needed for an additional
                        sub-architecture.
      --multiarch       do runtime tests on all installed sub-archs
      --no-multiarch    do runtime tests only on the main sub-architecture
      --force-multiarch run tests on all sub-archs even for packages
                        with no compiled code

By default, all test sections are turned on.

Report bugs at <https://bugs.R-project.org>.

Upvotes: 1

Related Questions