% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/url_check.R
\name{url_check}
\alias{url_check}
\title{Check urls in a package or project}
\usage{
url_check(
  path = ".",
  db = NULL,
  parallel = TRUE,
  pool = curl::new_pool(),
  progress = TRUE,
  fail = TRUE
)
}
\arguments{
\item{path}{Path(s) to check. Each element may be:
\itemize{
\item A package's (development) source directory tree, a directory holding an
unpacked source package, or a source package tarball (\code{.tar.gz}). A
tarball is unpacked into a temporary directory (kept for the rest of the
session, so the printed report can point into the sources).
\item A directory that is not an R package. All supported files found within
(recursively) are scanned for URLs. Supported files are HTML, PDF, Rd,
Markdown (\code{.md}, \code{.markdown}), R Markdown (\code{.Rmd}), Quarto (\code{.qmd}) and
BibTeX (\code{.bib}).
\item A single file of one of the supported types above.
}

\code{path} may be a character vector mixing any of these.}

\item{db}{A url database}

\item{parallel}{If \code{TRUE}, check the URLs in parallel}

\item{pool}{A multi handle created by \code{\link[curl:new_pool]{curl::new_pool()}}. If \code{NULL} use a global pool.}

\item{progress}{Whether to show the progress bar for parallel checks}

\item{fail}{If \code{TRUE} (the default), throw an error when one or more URLs
are flagged, after printing the report. This yields a non-zero exit status,
which is useful in CI/CD workflows. Set to \code{FALSE} to return the results
instead of failing.}
}
\value{
A \code{url_checker_db} object (invisibly). This is a \code{check_url_db} object
with an added class with a custom print method.
}
\description{
For an R package, runs the \code{url_db_from_package_source} function in the
tools package along with functions to check URLs in un-rendered Rmarkdown
(\code{.Rmd}) and Quarto (\code{.qmd}) vignettes and in BibTeX (\code{.bib}) bibliographies.
For non-package projects, URLs are extracted from all supported files found
in the given directories.
}
\section{Ignoring URLs with \code{.urlignore}}{


Some URLs cannot be checked automatically, e.g. a link to a private
repository, or a page behind a login or captcha. To stop \code{url_check()} from
flagging (and even requesting) such URLs, list them in a \code{.urlignore} file.
It is read from two locations relative to the checked root, and the patterns
found are combined:
\itemize{
\item \code{.urlignore} in the root directory (like \code{.gitignore}), and
\item \code{tools/.urlignore} (handy for packages that keep it under \verb{tools/}).
}

Each non-empty line is a glob pattern (blank lines and lines starting with
\verb{#} are ignored), matched against the whole URL. For example
\verb{https://github.com/acme/secret} matches that URL exactly, while
\verb{https://github.com/acme/*} matches every URL under that path. Matching URLs
are dropped before checking, so they are never requested.

Note that CRAN's own URL checks do not read \code{.urlignore}, so an ignored URL
may still be flagged when the package is submitted to CRAN.
}

\examples{
\dontrun{
url_check("my_pkg")
url_check(c("README.md", "docs"))
}
}
