Skip to content

Commit 1c4f5ee

Browse files
author
hornik
committed
NOTE missing dependency on R >= 4.1.0 when using pipe or function
shorthand in package code files. git-svn-id: https://svn.r-project.org/R/trunk@87614 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent a882c8c commit 1c4f5ee

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/library/tools/R/check.R

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,6 +1250,24 @@ add_dummies <- function(dir, Log)
12501250
}
12511251
}
12521252
}
1253+
1254+
if(!is_base_pkg &&
1255+
!.package_metadata_has_depends_on_R_at_least(db, "4.1.0")) {
1256+
files <-
1257+
names(.package_code_using_R_4.1_syntax(dirname(dfile)))
1258+
if(length(files)) {
1259+
if(!any) noteLog(Log)
1260+
any <- TRUE
1261+
msg <- "Missing dependency on R >= 4.1.0 because package code uses the pipe |> or function shorthand \\(...) syntax added in R 4.1.0."
1262+
printLog(Log,
1263+
paste(c(strwrap(msg, indent = 2L, exdent = 2L),
1264+
" File(s) using such syntax:",
1265+
paste0(" ", .pretty_format(sort(files)))),
1266+
collapse = "\n"),
1267+
"\n")
1268+
}
1269+
}
1270+
12531271
if (!any) resultLog(Log, "OK")
12541272
## return (<never used in caller>):
12551273
db

0 commit comments

Comments
 (0)