File: isCRANcheck.Rd

package info (click to toggle)
r-cran-pkgmaker 0.27-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,152 kB
  • sloc: sh: 13; makefile: 2
file content (77 lines) | stat: -rw-r--r-- 2,872 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/packages.R
\name{isCRANcheck}
\alias{isCRANcheck}
\alias{isCRAN_timing}
\alias{isCHECK}
\title{Package Check Utils}
\usage{
isCRANcheck(...)

isCRAN_timing()

isCHECK()
}
\arguments{
\item{...}{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:
\describe{
\item{\code{'timing'}}{Check if the environment variable \code{_R_CHECK_TIMINGS_} is set,
as with the flag \code{'--timing'} was set.}
\item{\code{'cran'}}{Check if the environment variable \code{_R_CHECK_CRAN_INCOMING_} is set,
as with the flag \code{'--as-cran'} was set.}
}}
}
\description{
\code{isCRANcheck} \strong{tries} to identify if one is running CRAN-like checks.
}
\details{
Currently \code{isCRANcheck} returns \code{TRUE} if the check is run with
either environment variable \code{_R_CHECK_TIMINGS_} (as set by flag \code{'--timings'})
or \code{_R_CHECK_CRAN_INCOMINGS_} (as set by flag \code{'--as-cran'}).

\strong{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.
}
\section{Functions}{
\itemize{
\item \code{isCRAN_timing}: tells if one is running CRAN check with flag \code{'--timing'}.

\item \code{isCHECK}: tries harder to test if running under \code{R CMD check}.
It will definitely identifies check runs for:
\itemize{
\item unit tests that use the unified unit test framework defined by \pkg{pkgmaker} (see \code{\link{utest}});
\item examples that are run with option \code{R_CHECK_RUNNING_EXAMPLES_ = TRUE},
which is automatically set for man pages generated with a fork of \pkg{roxygen2} (see \emph{References}).
}

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

\examples{
\dontshow{
options(R_CHECK_RUNNING_EXAMPLES_=TRUE) ## roxygen generated flag
}


isCHECK()

}
\references{
Adapted from the function \code{CRAN}
in the \pkg{fda} package.

\url{https://github.com/renozao/roxygen}
}