Skip to content

Commit badf171

Browse files
committed
last test fixes before resubmission
1 parent b19b49e commit badf171

5 files changed

+34
-19
lines changed

R/align_annotations.R

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
#' @return A character vector with vertically aligned package calls.
99
#'
1010
align_annotations <- function(annot_string,
11-
regex_ai = "(?!\\))(?!\\s)(?=\\#\\sCRAN\\sv|\\#\\sBiocon|\\#\\snot\\sinstal|\\#\\s\\[)",
11+
regex_ai = paste0(
12+
"(?!\\))(?!\\s)(?=\\#\\sCRAN\\sv|",
13+
"\\#\\sBiocon|\\#\\snot\\sinstall|",
14+
"\\#\\s\\[|\\#\\sPosit R)"),
1215
sep_str = "") {
1316
if (!is.character(annot_string)) {
1417
stop("input 'stringvec' must be a character vector")

R/annotate_repo_source.R

+12-6
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ annotate_repo_source <- function(string_og) {
4747
"(?<!/)/(?!/)"
4848
) ~ paste0("[", .data$repo, "::", user_repo, "]"), TRUE ~ user_repo))
4949
pck_descs <- dplyr::mutate(pck_descs, version = pkg_version(.data$pkgname_clean))
50-
# case with a single locally installed package
50+
# edge case with a single locally installed package
5151
if (nrow(pck_descs) == 0) {
5252
locannot <- paste(out_tb$call,"# local install")
5353
return(
@@ -61,7 +61,10 @@ annotate_repo_source <- function(string_og) {
6161

6262
# build annotation
6363
if (all(!grepl("p_load", pck_descs$call))) { # no pacman calls
64-
pck_descs$annotated <- paste0(pck_descs$call, " # ", pck_descs$annotation, " v", pck_descs$version)
64+
pck_descs <- dplyr::mutate(pck_descs,annotated=dplyr::case_when(
65+
stringr::str_detect(annotation,"not installed")~paste0(call, " #", " ", annotation, " vNA"),
66+
TRUE~ paste0(call, " #", " ", annotation, " v", version)
67+
))
6568
return(
6669
align_annotations(stringi::stri_replace_all_fixed(
6770
str = string_og, pattern = pck_descs$call,
@@ -71,7 +74,7 @@ annotate_repo_source <- function(string_og) {
7174
}
7275

7376
if (all(grepl("p_load", pck_descs$call))) { # only pacman calls
74-
pacld <- pck_descs[stringr::str_detect(out_tb$call, ".+load\\("), ]
77+
pacld <- pck_descs[which(stringr::str_detect(out_tb$call, ".+load\\(")), ]
7578
pacld$pkgnamesep <- paste0(pacld$package_name, ",")
7679
pacld <- dplyr::mutate(dplyr::group_by(pacld, call), pkgnamesep = ifelse(dplyr::row_number() == dplyr::n(), gsub(",", "", .data$pkgnamesep), .data$pkgnamesep))
7780
pacld$annotatedpac <- paste0(pacld$pkgnamesep, " # ", pacld$annotation, " v", pacld$version)
@@ -87,7 +90,7 @@ annotate_repo_source <- function(string_og) {
8790
}
8891

8992
if (any(grepl("p_load", pck_descs$call)) & any(grepl("libr|req", out_tb$call))) { # pacman and base calls
90-
pacld <- pck_descs[stringr::str_detect(out_tb$call, ".+load\\("), ]
93+
pacld <- pck_descs[which(stringr::str_detect(pck_descs$call, ".+load\\(")), ]
9194
pacld$pkgnamesep <- paste0(pacld$package_name, ",")
9295
pacld <- dplyr::mutate(dplyr::group_by(pacld, call), pkgnamesep = ifelse(dplyr::row_number() == dplyr::n(), gsub(",", "", .data$pkgnamesep), .data$pkgnamesep))
9396
pacld$annotatedpac <- paste0(pacld$pkgnamesep, " # ", pacld$annotation, " v", pacld$version)
@@ -99,12 +102,15 @@ annotate_repo_source <- function(string_og) {
99102
replacement = pacld$annotpac, vectorize_all = FALSE
100103
)
101104
pck_descs <- pck_descs[!stringr::str_detect(out_tb$call, ".+load\\("), ]
102-
pck_descs$annotated <- paste0(pck_descs$call, " # ", pck_descs$annotation, " v", pck_descs$version)
105+
pck_descs <- dplyr::mutate(pck_descs,annotated=dplyr::case_when(
106+
stringr::str_detect(annotation,"not installed")~paste0(call, " #", " ", annotation, " vNA"),
107+
TRUE~ paste0(call, " #", " ", annotation, " v", version)
108+
))
103109

104110
return(
105111
align_annotations(
106112
stringi::stri_replace_all_fixed(
107-
str = string_og, pattern = out_tb$call,
113+
str = string_og, pattern = pck_descs$call,
108114
replacement = pck_descs$annotated, vectorize_all = FALSE
109115
)
110116
)

R/annotate_repostitle.R

+12-7
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ annotate_repostitle <- function(string_og) {
4343
.data$repo == "Bioconductor" ~ "Bioconductor",
4444
.data$repo == "RSPM" ~ "Posit RPSM",
4545
.data$repo == "none" ~ "not installed on this machine",
46-
str_detect(.data$repo,"universe")~.data$repo,# for Runiverse pkgs
46+
stringr::str_detect(.data$repo,"universe")~.data$repo,# for Runiverse pkgs
4747
TRUE ~ repo_details(.data$pkgname_clean)
4848
), annotation = dplyr::case_when(stringr::str_detect(
4949
user_repo,
@@ -53,8 +53,10 @@ annotate_repostitle <- function(string_og) {
5353

5454
# build annotations
5555
if (all(!grepl("p_load", pck_descs$call))) { # no pacman calls
56-
pck_descs$annotated <- paste0(pck_descs$call, " # ", pck_descs$title, ", ", pck_descs$annotation, " v", pck_descs$version)
57-
56+
pck_descs <- dplyr::mutate(pck_descs,annotated=dplyr::case_when(
57+
stringr::str_detect(title,"not installed")~paste0(call, " # ", annotation, " vNA"),
58+
TRUE~ paste0(call, " # ", title, " ", annotation, " v", version)
59+
))
5860
return(
5961
stringi::stri_replace_all_fixed(
6062
str = string_og, pattern = pck_descs$call,
@@ -64,7 +66,7 @@ annotate_repostitle <- function(string_og) {
6466
}
6567

6668
if (all(grepl("p_load", pck_descs$call))) { # only pacman calls
67-
pacld <- pck_descs[which(stringr::str_detect(out_tb$call, ".+load\\(")), ]
69+
pacld <- pck_descs[which(stringr::str_detect(pck_descs$call, ".+load\\(")), ]
6870
pacld$pkgnamesep <- paste0(pacld$package_name, ", ")
6971
pacld <- dplyr::mutate(dplyr::group_by(pacld, call), pkgnamesep = ifelse(dplyr::row_number() == dplyr::n(), gsub(",", "", .data$pkgnamesep), .data$pkgnamesep))
7072
pacld$annotatedpac <- paste0(pacld$pkgnamesep, "# ", pacld$title, " ", pacld$annotation, " v", pacld$version)
@@ -80,7 +82,7 @@ annotate_repostitle <- function(string_og) {
8082
}
8183

8284
if (any(grepl("p_load", pck_descs$call)) & any(grepl("libr|req", out_tb$call))) { # pacman and base calls
83-
pacld <- pck_descs[which(stringr::str_detect(out_tb$call, ".+load\\(")), ]
85+
pacld <- pck_descs[which(stringr::str_detect(pck_descs$call, ".+load\\(")), ]
8486
pacld$pkgnamesep <- paste0(pacld$package_name, ", ")
8587
pacld <- dplyr::mutate(dplyr::group_by(pacld, call), pkgnamesep = ifelse(dplyr::row_number() == dplyr::n(), gsub(",", "", .data$pkgnamesep), .data$pkgnamesep))
8688
pacld$annotatedpac <- paste0(pacld$pkgnamesep, "# ", pacld$title, " ", pacld$annotation, " v", pacld$version)
@@ -91,8 +93,11 @@ annotate_repostitle <- function(string_og) {
9193
str = string_og, pattern = pacld$call,
9294
replacement = pacld$annotpac, vectorize_all = FALSE
9395
)
94-
pck_descs <- pck_descs[!stringr::str_detect(out_tb$call, ".+load\\("), ]
95-
pck_descs$annotated <- paste0(pck_descs$call, " # ", pck_descs$title, " ", pck_descs$annotation, " v", pck_descs$version)
96+
pck_descs <- pck_descs[which(!stringr::str_detect(pck_descs$call, ".+load\\(")), ]
97+
pck_descs <- dplyr::mutate(pck_descs,annotated=dplyr::case_when(
98+
stringr::str_detect(title,"not installed")~paste0(call, " #", " ", annotation, " vNA"),
99+
TRUE~ paste0(call, " # ", title, " ", annotation, " v", version)
100+
))
96101

97102
return(
98103
stringi::stri_replace_all_fixed(

cran-comments.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## Test environments
2-
- R-hub Windows Server 2022 (r-devel,64 bit)
3-
- R-hub fedora-clang-devel (r-devel)
2+
- Windows Server 2022 (r-devel,64 bit) [build 20348]
3+
- R-hub Fedora Linux, R-devel, clang, gfortran
4+
- R-hub Ubuntu Linux 20.04.1 LTS, R-release, GCC
45

56
No ERRORs or WARNINGs
67

@@ -9,4 +10,4 @@ No ERRORs, WARNINGs, or NOTEs.
910

1011
## No dependency issues
1112

12-
* This minor patch includes test fixes and modernization of tidyselect helpers.
13+
* This minor patch includes test fixes and modernization of tidyselect helpers, fewer assumptions about the package sources in different build environments.

man/align_annotations.Rd

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)