From c4b8e349a3f9d8abbb4f296f5e9fdf74e65d2aef Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Sat, 23 Dec 2023 10:20:12 +0800 Subject: [PATCH] Add a version-specific workaround for lint() and lint_dir() (#2503) * Add a version-specific workaround for lint() and lint_dir() * fix call order Co-authored-by: AshesITR * fix call order Co-authored-by: AshesITR --------- Co-authored-by: AshesITR --- R/lint.R | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/R/lint.R b/R/lint.R index 541006dd7..b4fec08cd 100644 --- a/R/lint.R +++ b/R/lint.R @@ -34,7 +34,9 @@ #' #' @export lint <- function(filename, linters = NULL, ..., cache = FALSE, parse_settings = TRUE, text = NULL) { - check_dots(...names(), c("exclude", "parse_exclusions")) + # TODO(#2502): Remove this workaround. + dot_names <- if (getRversion() %in% c("4.1.1", "4.1.2")) names(list(...)) else ...names() + check_dots(dot_names, c("exclude", "parse_exclusions")) needs_tempfile <- missing(filename) || re_matches(filename, rex(newline)) inline_data <- !is.null(text) || needs_tempfile @@ -137,7 +139,9 @@ lint_dir <- function(path = ".", ..., pattern = "(?i)[.](r|rmd|qmd|rnw|rhtml|rrst|rtex|rtxt)$", parse_settings = TRUE, show_progress = NULL) { - check_dots(...names(), c("lint", "exclude", "parse_exclusions")) + # TODO(#2502): Remove this workaround. + dot_names <- if (getRversion() %in% c("4.1.1", "4.1.2")) names(list(...)) else ...names() + check_dots(dot_names, c("lint", "exclude", "parse_exclusions")) if (isTRUE(parse_settings)) { read_settings(path)