diff --git a/R/backport_linter.R b/R/backport_linter.R index ad4fe0759..29608f6f3 100644 --- a/R/backport_linter.R +++ b/R/backport_linter.R @@ -35,6 +35,11 @@ #' @export backport_linter <- function(r_version = getRversion(), except = character()) { r_version <- normalize_r_version(r_version) + + if (all(r_version >= R_system_version(names(backports)))) { + return(Linter(function(source_expression) list())) + } + backport_blacklist <- backports[r_version < R_system_version(names(backports))] backport_blacklist <- lapply(backport_blacklist, setdiff, except) @@ -44,9 +49,6 @@ backport_linter <- function(r_version = getRversion(), except = character()) { if (!is_lint_level(source_expression, "expression")) { return(list()) } - if (all(r_version >= R_system_version(names(backports)))) { - return(list()) - } xml <- source_expression$xml_parsed_content