Skip to content

Commit 5873c17

Browse files
committed
lint: making rlang calls explicit
1 parent 76e3d51 commit 5873c17

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

R/import-standalone-obj-type.R

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
#' article, e.g. "an integer vector".
6868
#' @noRd
6969
obj_type_friendly <- function(x, value = TRUE) {
70-
if (is_missing(x)) {
70+
if (rlang::is_missing(x)) {
7171
return("absent")
7272
}
7373

@@ -80,15 +80,15 @@ obj_type_friendly <- function(x, value = TRUE) {
8080
return(sprintf("a <%s> object", type))
8181
}
8282

83-
if (!is_vector(x)) {
83+
if (!rlang::is_vector(x)) {
8484
return(.rlang_as_friendly_type(typeof(x)))
8585
}
8686

8787
n_dim <- length(dim(x))
8888

8989
if (!n_dim) {
90-
if (!is_list(x) && length(x) == 1) {
91-
if (is_na(x)) {
90+
if (!rlang::is_list(x) && length(x) == 1) {
91+
if (rlang::is_na(x)) {
9292
return(switch(
9393
typeof(x),
9494
logical = "`NA`",
@@ -173,8 +173,8 @@ obj_type_friendly <- function(x, value = TRUE) {
173173
}
174174

175175
vec_type_friendly <- function(x, length = FALSE) {
176-
if (!is_vector(x)) {
177-
abort("`x` must be a vector.")
176+
if (!rlang::is_vector(x)) {
177+
rlang::abort("`x` must be a vector.")
178178
}
179179
type <- typeof(x)
180180
n_dim <- length(dim(x))
@@ -260,8 +260,8 @@ vec_type_friendly <- function(x, length = FALSE) {
260260
)
261261
}
262262

263-
.rlang_stop_unexpected_typeof <- function(x, call = caller_env()) {
264-
abort(
263+
.rlang_stop_unexpected_typeof <- function(x, call = rlang::caller_env()) {
264+
rlang::abort(
265265
sprintf("Unexpected type <%s>.", typeof(x)),
266266
call = call
267267
)
@@ -296,7 +296,7 @@ obj_type_oo <- function(x) {
296296
#' character vector of expected types, in which case the error
297297
#' message mentions all of them in an "or" enumeration.
298298
#' @param show_value Passed to `value` argument of `obj_type_friendly()`.
299-
#' @param ... Arguments passed to [abort()].
299+
#' @param ... Arguments passed to [rlang::abort()].
300300
#' @inheritParams args_error_context
301301
#' @noRd
302302
stop_input_type <- function(
@@ -306,11 +306,11 @@ stop_input_type <- function(
306306
allow_na = FALSE,
307307
allow_null = FALSE,
308308
show_value = TRUE,
309-
arg = caller_arg(x),
310-
call = caller_env()
309+
arg = rlang::caller_arg(x),
310+
call = rlang::caller_env()
311311
) {
312312
# From standalone-cli.R
313-
cli <- env_get_list(
313+
cli <- rlang::env_get_list(
314314
nms = c("format_arg", "format_code"),
315315
last = topenv(),
316316
default = function(x) sprintf("`%s`", x),
@@ -339,7 +339,7 @@ stop_input_type <- function(
339339
obj_type_friendly(x, value = show_value)
340340
)
341341

342-
abort(message, ..., call = call, arg = arg)
342+
rlang::abort(message, ..., call = call, arg = arg)
343343
}
344344

345345
oxford_comma <- function(chr, sep = ", ", final = "or") {

0 commit comments

Comments
 (0)