lint {lintr} | R Documentation |
lint()
lints a single file.
lint_dir()
lints all files in a directory.
line_pakage()
lints all likely locations for R files in a package, i.e.
R/
, tests/
, inst/
, vignettes/
, data-raw/
, and demo/
.
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
)
filename |
either the filename for a file to lint, or a character string of inline R code for linting.
The latter (inline data) applies whenever |
linters |
a named list of linter functions to apply. See linters for a full list of default and available linters. |
... |
additional arguments passed to |
cache |
given a logical, toggle caching of lint results. If passed a character string, store the cache in this directory. |
parse_settings |
whether to try and parse the settings. |
text |
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. |
path |
For the base directory of the project (for |
relative_path |
if |
exclusions |
exclusions for |
pattern |
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, ...) |
Read vigentte("lintr")
to learn how to configure which linters are run
by default.
A list of lint objects.
## Not run:
lint("some/file-name.R") # linting a file
lint("a = 123\n") # linting inline-code
lint(text = "a = 123") # linting inline-code
## End(Not run)
## Not run:
lint_dir()
lint_dir(
linters = list(semicolon_linter())
cache = TRUE,
exclusions = list("inst/doc/creating_linters.R" = 1, "inst/example/bad.R", "renv")
)
## End(Not run)
## Not run:
lint_package()
lint_package(
linters = linters_with_defaults(semicolon_linter = semicolon_linter())
cache = TRUE,
exclusions = list("inst/doc/creating_linters.R" = 1, "inst/example/bad.R")
)
## End(Not run)