Skip to content

Commit

Permalink
Add a version-specific workaround for lint() and lint_dir() (#2503)
Browse files Browse the repository at this point in the history
* Add a version-specific workaround for lint() and lint_dir()

* fix call order

Co-authored-by: AshesITR <[email protected]>

* fix call order

Co-authored-by: AshesITR <[email protected]>

---------

Co-authored-by: AshesITR <[email protected]>
  • Loading branch information
MichaelChirico and AshesITR authored Dec 23, 2023
1 parent 2a240d8 commit c4b8e34
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions R/lint.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit c4b8e34

Please sign in to comment.