Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

isCRANcheck

Package Check Utils


Description

isCRANcheck tries to identify if one is running CRAN-like checks.

Usage

isCRANcheck(...)

isCRAN_timing()

isCHECK()

Arguments

...

each argument specifies a set of tests to do using an AND operator. The final result tests if any of the test set is true. Possible values are:

'timing'

Check if the environment variable _R_CHECK_TIMINGS_ is set, as with the flag '--timing' was set.

'cran'

Check if the environment variable _R_CHECK_CRAN_INCOMING_ is set, as with the flag '--as-cran' was set.

Details

Currently isCRANcheck returns TRUE if the check is run with either environment variable _R_CHECK_TIMINGS_ (as set by flag '--timings') or _R_CHECK_CRAN_INCOMINGS_ (as set by flag '--as-cran').

Warning: the checks performed on CRAN check machines are on purpose not always run with such flags, so that users cannot effectively "trick" the checks. As a result, there is no guarantee this function effectively identifies such checks. If really needed for honest reasons, CRAN recommends users rely on custom dedicated environment variables to enable specific tests or examples.

Functions

  • isCRAN_timing: tells if one is running CRAN check with flag '--timing'.

  • isCHECK: tries harder to test if running under R CMD check. It will definitely identifies check runs for:

    • unit tests that use the unified unit test framework defined by pkgmaker (see utest);

    • examples that are run with option R_CHECK_RUNNING_EXAMPLES_ = TRUE, which is automatically set for man pages generated with a fork of roxygen2 (see References).

    Currently, isCHECK checks both CRAN expected flags, the value of environment variable _R_CHECK_RUNNING_UTESTS_, and the value of option R_CHECK_RUNNING_EXAMPLES_. It will return TRUE if any of these environment variables is set to anything not equivalent to FALSE, or if the option is TRUE. For example, the function utest sets it to the name of the package being checked (_R_CHECK_RUNNING_UTESTS_=<pkgname>), but unit tests run as part of unit tests vignettes are run with _R_CHECK_RUNNING_UTESTS_=FALSE, so that all tests are run and reported when generating them.

References

Adapted from the function CRAN in the fda package.

Examples

isCHECK()

pkgmaker

Development Utilities for R Packages

v0.32.2
GPL (>= 2)
Authors
Renaud Gaujoux [aut, cre]
Initial release
2020-10-20

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.