Skip to content

Commit

Permalink
Use rlang::is_call() in tar_assign()
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau committed Aug 20, 2024
1 parent c95761e commit d99f1c7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ importFrom(rlang,check_installed)
importFrom(rlang,enquo)
importFrom(rlang,expr)
importFrom(rlang,inform)
importFrom(rlang,is_call)
importFrom(rlang,is_missing)
importFrom(rlang,quo_squash)
importFrom(secretbase,siphash13)
Expand Down
5 changes: 1 addition & 4 deletions R/tar_assign.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,8 @@ tar_assign <- function(targets) {
as.list(expr[-1L]),
list(expr)
)
check_assign <- function(x) {
identical(x[[1L]], quote(`<-`)) || identical(x[[1L]], quote(`=`))
}
targets::tar_assert_true(
all(map_lgl(statements, check_assign)),
all(map_lgl(statements, ~rlang::is_call(.x, c("<-", "=")))),
msg = paste(
"tar_assign() code must be enclosed in curly braces if",
"it has multiple statements, and each statement",
Expand Down
2 changes: 1 addition & 1 deletion R/tar_package.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#' @importFrom parallel clusterCall clusterMap makePSOCKcluster parLapply
#' stopCluster
#' @importFrom rlang as_function as_quosure call2 check_installed enquo expr
#' inform is_missing quo_squash
#' inform is_call is_missing quo_squash
#' @importFrom secretbase siphash13
#' @importFrom targets tar_assert_chr tar_assert_dbl tar_assert_df
#' tar_assert_envir tar_assert_equal_lengths
Expand Down

0 comments on commit d99f1c7

Please sign in to comment.