This is a convenience wrapper around lintr::lint_dir()
which is tailored to a typical R Markdown package. To use this function, the
lintr package is required.
Usage
lint_rmd(
path = ".",
linters = default_linters,
cache = FALSE,
relative_path = TRUE,
exclusions = default_exclusions(excl_vignettes = TRUE),
pattern = "\\.[Rr]([Mm][Dd])?$",
parse_settings = TRUE,
show_progress = NULL
)
Arguments
- path
Path to the root of the package directory.
- linters
A named list of linter functions to apply. See linters for a full list of default and available linters.
- cache
When logical, toggle caching of lint results. If passed a character string, store the cache in this directory.
- relative_path
if
TRUE
, file paths are printed using their path relative to the base directory. IfFALSE
, use the full absolute path.- exclusions
exclusions for
exclude()
, relative to the package path.- pattern
pattern for files, by default it will take files with any of the extensions .R, .Rmd, .qmd, .Rnw, .Rhtml, .Rrst, .Rtex, .Rtxt allowing for lowercase r (.r, ...).
- parse_settings
Logical, default
TRUE
. Whether to try and parse the settings. Otherwise, thedefault_settings()
are used.- show_progress
Logical controlling whether to show linting progress with a simple text progress bar via
utils::txtProgressBar()
. The default behavior is to show progress ininteractive()
sessions not running a testthat suite.
Details
To avoid unnecessary noise, all the the generated R/*.gen.R
files as well as R Markdown vignettes under vignettes/*.Rmd
are excluded from linting.
This function is registered as an RStudio add-in, allowing RStudio users to assign a custom shortcut to it and to invoke it from the command palette.
See also
default_linters
and default_exclusions()
Other high-level functions:
load_pkg()
,
process_pkg()
,
purl_rmd()
,
run_nopurl_rmd()