Lint a file, directory, or packageSource:
lint()lints a single file.
lint_dir()lints all files in a directory.
lint_package()lints all likely locations for R files in a package, i.e.
lint( filename, linters = NULL, ..., cache = FALSE, parse_settings = TRUE, text = NULL ) lint_dir( path = ".", ..., relative_path = TRUE, exclusions = list("renv", "packrat"), pattern = rex::rex(".", one_of("Rr"), or("", "html", "md", "nw", "rst", "tex", "txt"), end), parse_settings = TRUE ) lint_package( path = ".", ..., relative_path = TRUE, exclusions = list("R/RcppExports.R"), parse_settings = TRUE )
either the filename for a file to lint, or a character string of inline R code for linting. The latter (inline data) applies whenever
filenamehas a newline character (\n).
a named list of linter functions to apply. See linters for a full list of default and available linters.
Provide additional arguments to be passed to:
exclude()(in case of
lint()(in case of
given a logical, toggle caching of lint results. If passed a character string, store the cache in this directory.
whether to try and parse the settings.
Optional argument for supplying a string or lines directly, e.g. if the file is already in memory or linting is being done ad hoc.
For the base directory of the project (for
lint_dir()) or package (for
TRUE, file paths are printed using their path relative to the base directory. If
FALSE, use the full absolute path.
exclude(), relative to the package path.
pattern for files, by default it will take files with any of the extensions .R, .Rmd, .Rnw, .Rhtml, .Rrst, .Rtex, .Rtxt allowing for lowercase r (.r, ...)
vignette("lintr") to learn how to configure which linters are run
Note that if files contain unparseable encoding problems, only the encoding problem will be linted to avoid
unintelligible error messages from other linters.