diff --git a/NAMESPACE b/NAMESPACE index 838d16b..2a70463 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -2,12 +2,21 @@ export(document_universe) export(is_online) +importFrom(cli,cli_abort) +importFrom(cli,cli_warn) +importFrom(curl,curl_fetch_memory) +importFrom(curl,new_handle) importFrom(dplyr,arrange) +importFrom(dplyr,case_when) importFrom(dplyr,filter) +importFrom(dplyr,full_join) importFrom(dplyr,mutate) importFrom(dplyr,select) importFrom(glue,glue) importFrom(rlang,.data) +importFrom(rlang,is_attached) importFrom(rlang,set_names) importFrom(rlang,warn) importFrom(tibble,as_tibble) +importFrom(utils,hsearch_db) +importFrom(utils,isS3method) diff --git a/R/document_universe.R b/R/document_universe.R index e508e0e..5cf55f0 100644 --- a/R/document_universe.R +++ b/R/document_universe.R @@ -15,20 +15,20 @@ document_universe_impl <- function(x, url_template = NULL) { } if (length(url_template) > 2L) { longer <- length(url_template) - cli::cli_abort("`url_template` must be of length 1 or 2, not {longer}.") + cli_abort("`url_template` must be of length 1 or 2, not {longer}.") } out <- mutate( out, - topic = dplyr::case_when( + topic = case_when( .data$type == "help" ~ to_href( .data$topic, - template = glue::glue(manual) + template = glue(manual) ), .data$type == "vignette" ~ to_href( .data$topic, - template = glue::glue(vignettes_template(vignettes)) + template = glue(vignettes_template(vignettes)) ), .default = .data$topic ) @@ -109,13 +109,13 @@ vignettes_template <- function(template) { #' document_universe(universe, template) document_universe <- function(x, url_template = NULL) { out <- document_universe_impl(x = x, url_template = url_template) - tibble::as_tibble(out) + as_tibble(out) } warn_unnattached <- function(x, doc = "package") { if (!all(attached(x))) { unattached <- x[!attached(x)] # nolint - cli::cli_warn(c( + cli_warn(c( "All packages should be attached to work properly.", x = "Not attached: {unattached}" )) @@ -143,7 +143,7 @@ tidy_reference <- function(data, strip_s3class) { } attached <- function(x) { - unlist(lapply(glue("package:{x}"), rlang::is_attached)) + unlist(lapply(glue("package:{x}"), is_attached)) } abort_unavailable_package <- function(data, x) { @@ -153,13 +153,13 @@ abort_unavailable_package <- function(data, x) { } is_unavailable <- x[!is_available] # nolint - cli::cli_abort("No pacakge matches '{is_unavailable}'.") + cli_abort("No pacakge matches '{is_unavailable}'.") } collapse_alias <- function(data, strip_s3class = FALSE) { out <- mutate( data, - alias = dplyr::case_when( + alias = case_when( !strip_s3class ~ may_strip_s3class(.data$alias, .f = identity), strip_s3class ~ may_strip_s3class(.data$alias, .f = s3_strip_class), ), diff --git a/R/dverse-package.R b/R/dverse-package.R index b1176ed..88c32fa 100644 --- a/R/dverse-package.R +++ b/R/dverse-package.R @@ -2,14 +2,23 @@ "_PACKAGE" ## usethis namespace: start +#' @importFrom cli cli_abort +#' @importFrom cli cli_warn +#' @importFrom curl curl_fetch_memory +#' @importFrom curl new_handle #' @importFrom dplyr arrange +#' @importFrom dplyr case_when #' @importFrom dplyr filter +#' @importFrom dplyr full_join #' @importFrom dplyr mutate #' @importFrom dplyr select #' @importFrom glue glue #' @importFrom rlang .data +#' @importFrom rlang is_attached #' @importFrom rlang set_names #' @importFrom rlang warn #' @importFrom tibble as_tibble +#' @importFrom utils hsearch_db +#' @importFrom utils isS3method ## usethis namespace: end NULL diff --git a/R/is_online.R b/R/is_online.R index 1e586fa..14465ed 100644 --- a/R/is_online.R +++ b/R/is_online.R @@ -21,7 +21,7 @@ is_online <- function(x) { is_online_once <- function(url) { tryCatch(error = function(e) FALSE, { - response <- curl::curl_fetch_memory(url, handle = curl::new_handle()) + response <- curl_fetch_memory(url, handle = new_handle()) identical(response$status_code, 200L) }) } diff --git a/R/s3_strip_class.R b/R/s3_strip_class.R index e16a6b4..abcdd2b 100644 --- a/R/s3_strip_class.R +++ b/R/s3_strip_class.R @@ -16,7 +16,7 @@ s3_strip_class_impl <- function(x) { ok <- logical(nfc) for (j in 2:nfc) { - ok[[j]] <- utils::isS3method( + ok[[j]] <- isS3method( f = paste(f_c[1:(j - 1)], collapse = "."), class = paste(f_c[j:nfc], collapse = ".") ) @@ -31,5 +31,5 @@ s3_strip_class_impl <- function(x) { } is_s3_method <- function(x) { - ifelse(startsWith(x, "."), FALSE, utils::isS3method(x)) + ifelse(startsWith(x, "."), FALSE, isS3method(x)) } diff --git a/R/search_documentation.R b/R/search_documentation.R index d92ec77..d49e542 100644 --- a/R/search_documentation.R +++ b/R/search_documentation.R @@ -1,6 +1,6 @@ search_documentation <- function() { docs <- suppressMessages( - Reduce(dplyr::full_join, utils::hsearch_db()) + Reduce(full_join, hsearch_db()) ) out <- set_names(docs, tolower)