diff --git a/R/inet.R b/R/inet.R index f5b6f88..d611d40 100644 --- a/R/inet.R +++ b/R/inet.R @@ -91,11 +91,12 @@ NULL }) }, warning = function(w) { msg <- conditionMessage(w) - if (grepl("not available", msg)) { + if (grepl("not available", msg, fixed = TRUE)) { msg <- gsub( "this version of R", paste0("Bioconductor version ", "'", version(), "'"), - msg + msg, + fixed = TRUE ) w <- simpleWarning(msg, conditionCall(w)) } diff --git a/R/install.R b/R/install.R index e681b9d..2f8b9fb 100644 --- a/R/install.R +++ b/R/install.R @@ -99,7 +99,7 @@ .install_github_load_remotes <- function(pkgs, lib.loc = NULL) { - if (!"remotes" %in% rownames(installed.packages(lib.loc))) { + if (!requireNamespace("remotes", lib.loc = lib.loc, quietly = TRUE)) { if (is.null(lib.loc)) lib.loc <- .libPaths() .stop( @@ -146,7 +146,7 @@ function(pkgs, lib, lib.loc, repos, update, ask, force, ...) { doing <- .install_filter_github_repos(pkgs) - ask <- if (!update) "never" else if (update && !ask) "always" else "default" + ask <- if (!update) "never" else if (!ask) "always" else "default" oopts <- options(repos = repos) # required by remotes:: on.exit(options(oopts)) diff --git a/R/utilities.R b/R/utilities.R index 6807194..2e27c64 100644 --- a/R/utilities.R +++ b/R/utilities.R @@ -129,6 +129,6 @@ isRelease <- .skip_if_BiocVersion_not_available <- function() { - if (!"BiocVersion" %in% rownames(installed.packages())) + if (!requireNamespace("BiocVersion", quietly = TRUE)) testthat::skip("BiocVersion not installed") } diff --git a/R/version.R b/R/version.R index 7737114..8b297e3 100644 --- a/R/version.R +++ b/R/version.R @@ -108,7 +108,7 @@ format.version_sentinel <- txt <- tryCatch(.inet_readLines(config), error = identity) if (inherits(txt, "error")) { if (startsWith(config, "https://")) - config <- sub("https", "http", config) + config <- sub("https", "http", config, fixed = TRUE) else if (!startsWith(config, "http")) config <- paste0("file://", config) txt <- tryCatch(.inet_readLines(config), error = identity) @@ -125,7 +125,7 @@ format.version_sentinel <- return(setNames(character(), character())) end <- ifelse(length(grps) < start + 1L, length(txt), grps[start + 1] - 1L) map <- txt[seq(grps[start] + 1, end)] - map <- trimws(gsub("\"", "", sub(" #.*", "", map))) + map <- trimws(gsub("\"", "", sub(" #.*", "", map), fixed = TRUE)) pattern <- "(.*): (.*)" key <- sub(pattern, "\\1", map) @@ -215,7 +215,7 @@ format.version_sentinel <- if (!.version_validity_online_check()) .version_map_get_offline() else { - if (is.null(config) || !nchar(config)) + if (is.null(config) || !nzchar(config)) config <- "https://bioconductor.org/config.yaml" .version_map_get_online(config) } @@ -263,7 +263,7 @@ format.version_sentinel <- sprintf( "Bioconductor version %s (BiocManager %s), %s", bioc_version, packageVersion("BiocManager"), - sub(" version", "", R.version.string) + sub(" version", "", R.version.string, fixed = TRUE) ) }