Performs each of the checks described in Details. All checks must pass for
check_standards
to return TRUE
.
check_standards(
path = NULL,
standards = c("check_rout", "check_header", "check_session_info")
)
a file path to an R or R Markdown file. Defaults to the path of the source editor context.
either a character
vector of the standards provided
and described with this function, or a list that can include the provided
standard names as well as custom functions. Custom functions should accept
arguments x
(a scanned R file) and path
(a file path). Custom
functions should return a named list consisting of a logical
element
named "pass" and a character
element named "reason" that describes
the reason the standard is not satisfied.
logical
indicating whether the file satisfied all standards.
check_rout
Determines if the R script should have an associated Rout file, then checks the content of the Rout.
check_header
Checks that the R script has an appropriate header.
check_session_info
Checks that
sessionInfo
or
session_info
is called in the R script, preferably
as the final call.
if (FALSE) { # \dontrun{
check_standards("script.R")
} # }