File: lint.R

package info (click to toggle)
r-cran-devtools 2.4.5-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,328 kB
  • sloc: sh: 15; makefile: 5
file content (23 lines) | stat: -rw-r--r-- 862 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#' Lint all source files in a package
#'
#' The default linters correspond to the style guide at
#' <https://style.tidyverse.org/>, however it is possible to override any or all
#' of them using the `linters` parameter.
#'
#' @template devtools
#' @param cache Store the lint results so repeated lints of the same content use
#'   the previous results. Consult the lintr package to learn more about its
#'   caching behaviour.
#' @param ... Additional arguments passed to [lintr::lint_package()].
#' @seealso [lintr::lint_package()], [lintr::lint()]
#' @export
lint <- function(pkg = ".", cache = TRUE, ...) {
  rlang::check_installed("lintr")
  pkg <- as.package(pkg)

  cli::cli_inform(c(i = "Linting {.pkg {pkg$package}}"))

  check_dots_used(action = getOption("devtools.ellipsis_action", rlang::warn))

  lintr::lint_package(pkg$path, cache = cache, ...)
}