\HeaderA{checkUsage}{Check R Code for Possible Problems}{checkUsage}
\aliasA{checkUsageEnv}{checkUsage}{checkUsageEnv}
\aliasA{checkUsagePackage}{checkUsage}{checkUsagePackage}
\keyword{programming}{checkUsage}
\begin{Description}\relax
Check R code for possible problems.
\end{Description}
\begin{Usage}
\begin{verbatim}
checkUsage(fun, name = "<anonymous>", report = cat, all = FALSE, 
           suppressLocal = FALSE, suppressParamAssigns = !all,
           suppressParamUnused = !all, suppressFundefMismatch = FALSE,
           suppressLocalUnused = FALSE, suppressNoLocalFun = !all,
           skipWith = FALSE, suppressUndefined = dfltSuppressUndefined) 
checkUsageEnv(env, ...) 
checkUsagePackage(pack, ...) 
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{fun}] closure.
\item[\code{name}] character; name of closure.
\item[\code{env}] environment containing closures to check.
\item[\code{pack}] character naming package to check.
\item[\code{...}] options to be passed to \code{checkUsage}.
\item[\code{report}] function to use to report possible problems.
\item[\code{all}] logical; report all possible problems if TRUE.
\item[\code{suppressLocal}] suppress all local variable warnings.
\item[\code{suppressParamAssigns}] suppress warnings about assignments to formal
parameters.
\item[\code{suppressParamUnused}] suppress warnings about unused formal
parameters.
\item[\code{suppressFundefMismatch}] suppress warnings about multiple local
function definitions with different formal
argument lists
\item[\code{suppressLocalUnused}] suppress warnings about unused local variables
\item[\code{suppressNoLocalFun}] suppress warnings about using local variables
as functions with no apparent local function
definition
\item[\code{skipWith}] logical; if true, do no examine code portion of
\code{with} expressions.
\item[\code{suppressUndefined}] suppress warnings about undefined global
functions and variables.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
\code{checkUsage} checks a single R closure.  Options control which
possible problems to report.  The default settings are moderately
verbose.  A first pass might use \code{suppressLocal=TRUE} to
suppress all information related to local variable usage.
The \code{suppressXYZ} values can either be scalar logicals or
character vectors; then they are character vectors they only
suppress problem reports for the variables with names in the vector.

\code{checkUsageEnv} and \code{checkUsagePackage} are convenience
functions that apply \code{checkUsage} to all closures in an
environment or a package.  \code{checkUsagePackage} requires that the
package be loaded.  If the package has a name space then the internal
name space frame is checked.
\end{Details}
\begin{Author}\relax
Luke Tierney
\end{Author}
\begin{Examples}
\begin{ExampleCode}
checkUsage(checkUsage)
checkUsagePackage("codetools",all=TRUE)
## Not run: checkUsagePackage("base",suppressLocal=TRUE)
\end{ExampleCode}
\end{Examples}

