From 4da229005fecd2ab0fbe92fe673ead062929bb99 Mon Sep 17 00:00:00 2001 From: wlandau Date: Mon, 10 Jun 2024 11:57:58 -0400 Subject: [PATCH 01/17] start issues_dependencies() --- R/record_issues.R | 6 +- tests/testthat/helper-mock.R | 133 +++++++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+), 2 deletions(-) diff --git a/R/record_issues.R b/R/record_issues.R index be17eb9..e4ef3ef 100644 --- a/R/record_issues.R +++ b/R/record_issues.R @@ -66,8 +66,10 @@ record_issues <- function( issues <- list() |> add_issues(issues_checks(meta = checks), "checks") |> add_issues(issues_descriptions(meta = packages), "descriptions") |> - add_issues(issues_versions(versions = versions), "versions") |> - overwrite_issues(output = output, today = today) + add_issues(issues_versions(versions = versions), "versions") + issues <- issues |> + add_issues(issues_dependencies(names(issues), packages), "dependencies") + overwrite_issues(issues = issues, output = output, today = today) invisible() } diff --git a/tests/testthat/helper-mock.R b/tests/testthat/helper-mock.R index 062e116..0095278 100644 --- a/tests/testthat/helper-mock.R +++ b/tests/testthat/helper-mock.R @@ -1,3 +1,4 @@ +# parse(text = deparse(meta_checks(repo = "https://multiverse.r-multiverse.org"))) # nolint mock_meta_checks <- structure( list( package = c( @@ -102,6 +103,7 @@ mock_meta_checks <- structure( row.names = c(NA, 19L) ) +# parse(text = deparse(meta_packages(repo = "https://multiverse.r-multiverse.org")) # nolint mock_meta_packages <- structure( list( package = c( @@ -126,6 +128,137 @@ mock_meta_packages <- structure( class = "data.frame" ) +# parse(text = deparse(meta_packages(repo = "https://wlandau.r-universe.dev")) # nolint +mock_meta_packages_graph <- structure( + list( + "_id" = c( + "666319a14e86770016661a28", "66580c6dd014ca0014e5afc2", + "665179088d83a20014a4037a", "6666d6575e691000165322b1", + "6666d6865e691000165322fe" + ), + package = c( + "crew", "crew.aws.batch", + "crew.cluster", "mirai", "nanonext" + ), + version = c( + "0.9.3.9002", "0.0.5.9000", "0.3.1", "1.1.0.9000", "1.1.0.9000" + ), + license = c( + "MIT + file LICENSE", "MIT + file LICENSE", + "MIT + file LICENSE", "GPL (>= 3)", "GPL (>= 3)" + ), + remotesha = c( + "eafad0276c06dec2344da2f03596178c754c8b5e", + "4d9e5b44e2942d119af963339c48d134e84de458", + "d4ac61fd9a1d9539088ffebdadcd4bb713c25ee1", + "7015695b7ef82f82ab3225ac2d226b2c8f298097", + "85dd672a44a92c890eb40ea9ebab7a4e95335c2f" + ), + needscompilation = c("no", "no", "no", "no", "yes"), + md5sum = c( + "642e9ac93d39d462ee6f95d8522afbe1", + "23c2733447eae95614fd6af1889b57e8", + "5707d786c1aa3848fd37e6bf4598ea4c", + "3c92053c75031ec0b976b0a15185e3a0", + "1507b3a27da7dff5d9acbf8ef181ad78" + ), + "_type" = c("src", "src", "src", "src", "src"), + "_dependencies" = list( + structure( + list( + package = c( + "R", "cli", "data.table", "getip", "later", "mirai", "nanonext", + "processx", "promises", "ps", "R6", "rlang", "stats", "tibble", + "tidyselect", "tools", "utils", "knitr", "markdown", "rmarkdown", + "testthat" + ), + version = c( + ">= 4.0.0", ">= 3.1.0", NA, NA, NA, ">= 0.12.0", ">= 0.12.0", + NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ">= 1.30", ">= 1.1", + ">= 2.4", ">= 3.0.0" + ), + role = c( + "Depends", "Imports", "Imports", "Imports", "Imports", "Imports", + "Imports", "Imports", "Imports", "Imports", "Imports", "Imports", + "Imports", "Imports", "Imports", "Imports", "Imports", "Suggests", + "Suggests", "Suggests", "Suggests" + ) + ), + class = "data.frame", + row.names = c(NA, 21L) + ), + structure( + list( + package = c( + "R", "cli", "crew", "paws.common", "paws.compute", + "paws.management", "R6", "rlang", "tibble", "utils", + "knitr", "markdown", "rmarkdown", "testthat" + ), + version = c( + ">= 4.0.0", ">= 3.1.0", ">= 0.8.0", ">= 0.7.0", + NA, NA, NA, NA, NA, NA, ">= 1.30", + ">= 1.1", ">= 2.4", ">= 3.0.0" + ), + role = c( + "Depends", "Imports", "Imports", "Imports", + "Imports", "Imports", "Imports", "Imports", + "Imports", "Imports", "Suggests", "Suggests", + "Suggests", "Suggests" + ) + ), + class = "data.frame", + row.names = c(NA, 14L) + ), + structure( + list( + package = c( + "R", "crew", "ps", "lifecycle", "R6", "rlang", "utils", "vctrs", + "xml2", "yaml", "knitr", "markdown", "rmarkdown", "testthat" + ), + version = c( + ">= 4.0.0", ">= 0.8.0", NA, NA, NA, NA, NA, NA, NA, NA, + ">= 1.30", ">= 1.1", ">= 2.4", ">= 3.0.0" + ), + role = c( + "Depends", "Imports", "Imports", "Imports", "Imports", + "Imports", "Imports", "Imports", "Imports", "Imports", + "Suggests", "Suggests", "Suggests", "Suggests" + ) + ), + class = "data.frame", + row.names = c(NA, 14L) + ), + structure( + list( + package = c( + "R", "nanonext", "knitr", "markdown", "parallel", "promises" + ), + version = c(">= 3.6", ">= 1.1.0.9000", NA, NA, NA, NA), + role = c( + "Depends", "Imports", "Suggests", + "Suggests", "Enhances", "Enhances" + ) + ), + class = "data.frame", + row.names = c(NA, 6L) + ), + structure( + list( + package = c("R", "later", "later", "knitr", "markdown"), + version = c(">= 3.5", NA, NA, NA, NA), + role = c("Depends", "LinkingTo", "Imports", "Suggests", "Suggests") + ), + class = "data.frame", + row.names = c(NA, 5L) + ) + ), + distro = c("noble", "noble", "noble", "noble", "noble") + ), + class = "data.frame", + row.names = c(NA, 5L) +) + +# From tests/testthat/test-record_versions.R mock_versions <- function() { lines <- c( "[", From ffd304f68dab4090b7c62cb9a335cd4537a6ffcc Mon Sep 17 00:00:00 2001 From: wlandau Date: Mon, 10 Jun 2024 13:47:48 -0400 Subject: [PATCH 02/17] test issues_dependencies() --- DESCRIPTION | 1 + NAMESPACE | 4 + R/issues_dependencies.R | 71 ++++++++++ R/package.R | 1 + man/issues_checks.Rd | 1 + man/issues_dependencies.Rd | 69 ++++++++++ man/issues_descriptions.Rd | 1 + man/issues_versions.Rd | 1 + tests/testthat/test-issues_dependencies.R | 150 ++++++++++++++++++++++ 9 files changed, 299 insertions(+) create mode 100644 R/issues_dependencies.R create mode 100644 man/issues_dependencies.Rd create mode 100644 tests/testthat/test-issues_dependencies.R diff --git a/DESCRIPTION b/DESCRIPTION index 88822bc..4b4cb32 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -29,6 +29,7 @@ Depends: R (>= 3.5.0) Imports: gh, + igraph, jsonlite, nanonext, pkgsearch, diff --git a/NAMESPACE b/NAMESPACE index f976b55..b0afedc 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -6,6 +6,7 @@ export(assert_package) export(assert_release_exists) export(get_current_versions) export(issues_checks) +export(issues_dependencies) export(issues_descriptions) export(issues_versions) export(meta_checks) @@ -16,6 +17,9 @@ export(review_pull_request) export(review_pull_requests) export(try_message) importFrom(gh,gh) +importFrom(igraph,graph) +importFrom(igraph,neighbors) +importFrom(igraph,subcomponent) importFrom(jsonlite,parse_json) importFrom(jsonlite,read_json) importFrom(jsonlite,stream_in) diff --git a/R/issues_dependencies.R b/R/issues_dependencies.R new file mode 100644 index 0000000..354de1c --- /dev/null +++ b/R/issues_dependencies.R @@ -0,0 +1,71 @@ +#' @title Report package dependency issues +#' @export +#' @family issues +#' @description Flag packages which have issues in their strong dependencies +#' (`Imports:`, `Depends:`, and `LinkingTo:` in the `DESCRIPTION`.) +#' These include indirect/upstream dependencies, as well, not just +#' the explicit mentions in the `DESCRIPTION` file. +#' @inheritSection record_issues Package issues +#' @return A nested list of problems triggered by dependencies. +#' The names of top-level elements are packages affected downstream. +#' The value of each top-level element is a list whose names are +# packages at the source of a problem upstream. +#' Each element of this inner list is a character +#' vector of relevant dependencies of the downstream package. +#' +#' For example, consider a linear dependency graph where `crew.cluster` +#' depends on `crew`, `crew` depends on `mirai`, and +#' `mirai` depends on `nanonext`. We represent the graph like this: +#' `nanonext -> mirai -> crew -> crew.cluster`. +#' If `nanonext` has an issue, then [issues_dependencies()] returns +#' `list(crew.cluster = list(nanonext = "crew"), ...)`, where `...` +#' stands for additional named list entries. From this list, we deduce +#' that `nanonext` is causing an issue affecting `crew.cluster` through +#' the direct dependency on `crew`. +#' +#' The choice in output format from [issues_dependencies()] allows package +#' maintainers to more easily figure out which direct dependencies +#' are contributing issues and drop those direct dependencies if necessary. +#' @param names Names of packages with other issues. +#' @param meta A data frame with R-universe package check results +#' returned by [meta_checks()]. +#' @examples +#' meta <- meta_packages(repo = "https://wlandau.r-universe.dev") +#' issues_dependencies(packages = character(0L), meta = meta) +#' issues_dependencies(packages = "crew.aws.batch", meta = meta) +#' issues_dependencies(packages = "nanonext", meta = meta) +#' issues_dependencies(packages = "crew", meta = meta) +#' issues_dependencies(packages = c("crew", "mirai"), meta = meta) +issues_dependencies <- function(packages, meta) { + graph <- issues_dependencies_graph(meta) + issues <- list() + for (package in packages) { + revdeps <- names(igraph::subcomponent(graph, v = package, mode = "out")) + revdeps <- setdiff(revdeps, package) + for (revdep in revdeps) { + neighbors <- names(igraph::neighbors(graph, v = revdep, mode = "in")) + issues[[revdep]][[package]] <- intersect(neighbors, revdeps) + } + } + issues +} + +issues_dependencies_graph <- function(meta) { + repo_packages <- meta$package + repo_dependencies <- meta[["_dependencies"]] + edge_list <- list() + for (index in seq_len(nrow(meta))) { + package <- .subset2(repo_packages, index) + all <- .subset2(repo_dependencies, index) + packages <- .subset2(all, "package") + role <- .subset2(all, "role") + strong <- packages[role %in% c("Depends", "Imports", "LinkingTo")] + strong <- intersect(setdiff(unique(strong), "R"), repo_packages) + edges <- rep(strong, each = 2L) + if (length(edges) >= 2L) { + edges[seq(from = 2L, to = length(edges), by = 2L)] <- package + edge_list[[index]] <- edges + } + } + igraph::graph(edges = unlist(edge_list)) +} diff --git a/R/package.R b/R/package.R index 76f04ab..4ae068d 100644 --- a/R/package.R +++ b/R/package.R @@ -1,4 +1,5 @@ #' @importFrom gh gh +#' @importFrom igraph graph neighbors subcomponent #' @importFrom jsonlite parse_json read_json stream_in write_json #' @importFrom nanonext ncurl parse_url status_code #' @importFrom pkgsearch cran_package diff --git a/man/issues_checks.Rd b/man/issues_checks.Rd index 8197040..a254b3a 100644 --- a/man/issues_checks.Rd +++ b/man/issues_checks.Rd @@ -45,6 +45,7 @@ together all the issues about R-multiverse packages. } \seealso{ Other issues: +\code{\link{issues_dependencies}()}, \code{\link{issues_descriptions}()}, \code{\link{issues_versions}()} } diff --git a/man/issues_dependencies.Rd b/man/issues_dependencies.Rd new file mode 100644 index 0000000..51b3d68 --- /dev/null +++ b/man/issues_dependencies.Rd @@ -0,0 +1,69 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/issues_dependencies.R +\name{issues_dependencies} +\alias{issues_dependencies} +\title{Report package dependency issues} +\usage{ +issues_dependencies(packages, meta) +} +\arguments{ +\item{meta}{A data frame with R-universe package check results +returned by \code{\link[=meta_checks]{meta_checks()}}.} + +\item{names}{Names of packages with other issues.} +} +\value{ +A nested list of problems triggered by dependencies. +The names of top-level elements are packages affected downstream. +The value of each top-level element is a list whose names are +Each element of this inner list is a character +vector of relevant dependencies of the downstream package. + +For example, consider a linear dependency graph where \code{crew.cluster} +depends on \code{crew}, \code{crew} depends on \code{mirai}, and +\code{mirai} depends on \code{nanonext}. We represent the graph like this: +\code{nanonext -> mirai -> crew -> crew.cluster}. +If \code{nanonext} has an issue, then \code{\link[=issues_dependencies]{issues_dependencies()}} returns +\code{list(crew.cluster = list(nanonext = "crew"), ...)}, where \code{...} +stands for additional named list entries. From this list, we deduce +that \code{nanonext} is causing an issue affecting \code{crew.cluster} through +the direct dependency on \code{crew}. + +The choice in output format from \code{\link[=issues_dependencies]{issues_dependencies()}} allows package +maintainers to more easily figure out which direct dependencies +are contributing issues and drop those direct dependencies if necessary. +} +\description{ +Flag packages which have issues in their strong dependencies +(\verb{Imports:}, \verb{Depends:}, and \verb{LinkingTo:} in the \code{DESCRIPTION}.) +These include indirect/upstream dependencies, as well, not just +the explicit mentions in the \code{DESCRIPTION} file. +} +\section{Package issues}{ + +Functions like \code{\link[=issues_versions]{issues_versions()}} and \code{\link[=issues_descriptions]{issues_descriptions()}} +perform health checks for all packages in R-multiverse. +Only packages that pass these checks go to the production repository at +\url{https://production.r-multiverse.org}. For a complete list of checks, see +the \verb{issues_*()} functions listed at +\url{https://r-multiverse.org/multiverse.internals/reference.html}. +\code{\link[=record_versions]{record_versions()}} updates the version number history +of releases in R-multiverse, and \code{\link[=record_issues]{record_issues()}} gathers +together all the issues about R-multiverse packages. +} + +\examples{ + meta <- meta_packages(repo = "https://wlandau.r-universe.dev") + issues_dependencies(packages = character(0L), meta = meta) + issues_dependencies(packages = "crew.aws.batch", meta = meta) + issues_dependencies(packages = "nanonext", meta = meta) + issues_dependencies(packages = "crew", meta = meta) + issues_dependencies(packages = c("crew", "mirai"), meta = meta) +} +\seealso{ +Other issues: +\code{\link{issues_checks}()}, +\code{\link{issues_descriptions}()}, +\code{\link{issues_versions}()} +} +\concept{issues} diff --git a/man/issues_descriptions.Rd b/man/issues_descriptions.Rd index 3441404..3edbf10 100644 --- a/man/issues_descriptions.Rd +++ b/man/issues_descriptions.Rd @@ -46,6 +46,7 @@ together all the issues about R-multiverse packages. \seealso{ Other issues: \code{\link{issues_checks}()}, +\code{\link{issues_dependencies}()}, \code{\link{issues_versions}()} } \concept{issues} diff --git a/man/issues_versions.Rd b/man/issues_versions.Rd index c6d8796..1503051 100644 --- a/man/issues_versions.Rd +++ b/man/issues_versions.Rd @@ -86,6 +86,7 @@ together all the issues about R-multiverse packages. \seealso{ Other issues: \code{\link{issues_checks}()}, +\code{\link{issues_dependencies}()}, \code{\link{issues_descriptions}()} } \concept{issues} diff --git a/tests/testthat/test-issues_dependencies.R b/tests/testthat/test-issues_dependencies.R new file mode 100644 index 0000000..c39467a --- /dev/null +++ b/tests/testthat/test-issues_dependencies.R @@ -0,0 +1,150 @@ +test_that("dependency graph is correct", { + graph <- issues_dependencies_graph(meta = mock_meta_packages_graph) + out <- igraph::as_data_frame(graph, what = "edges") + out <- out[order(out$from), ] + expect_equal(out$from[out$to == "crew.aws.batch"], "crew") + expect_equal(out$from[out$to == "crew.cluster"], "crew") + expect_equal(out$to[out$from == "mirai"], "crew") + expect_equal( + sort(out$to[out$from == "nanonext"]), + c("crew", "mirai") + ) +}) + +test_that("issues_dependencies() no issues", { + expect_equal( + issues_dependencies( + packages = character(0L), + meta = mock_meta_packages_graph + ), + list() + ) +}) + +test_that("issues_dependencies() no revdeps", { + expect_equal( + issues_dependencies( + packages = "crew.aws.batch", + meta = mock_meta_packages_graph + ), + list() + ) +}) + +test_that("issues_dependencies() nanonext", { + expect_equal( + issues_dependencies( + packages = "nanonext", + meta = mock_meta_packages_graph + ), + list( + mirai = list(nanonext = character(0L)), + crew = list(nanonext = "mirai"), + crew.aws.batch = list(nanonext = "crew"), + crew.cluster = list(nanonext = "crew") + ) + ) +}) + +test_that("issues_dependencies() mirai", { + expect_equal( + issues_dependencies( + packages = "mirai", + meta = mock_meta_packages_graph + ), + list( + crew = list(mirai = character(0L)), + crew.aws.batch = list(mirai = "crew"), + crew.cluster = list(mirai = "crew") + ) + ) +}) + +test_that("issues_dependencies() crew", { + expect_equal( + issues_dependencies( + packages = "crew", + meta = mock_meta_packages_graph + ), + list( + crew.aws.batch = list(crew = character(0L)), + crew.cluster = list(crew = character(0L)) + ) + ) +}) + +test_that("issues_dependencies() nanonext and mirai", { + expect_equal( + issues_dependencies( + packages = c("nanonext", "mirai"), + meta = mock_meta_packages_graph + ), + list( + mirai = list(nanonext = character(0L)), + crew = list(nanonext = "mirai", mirai = character(0L)), + crew.aws.batch = list(nanonext = "crew", mirai = "crew"), + crew.cluster = list(nanonext = "crew", mirai = "crew") + ) + ) +}) + +test_that("issues_dependencies() nanonext and mirai", { + expect_equal( + issues_dependencies( + packages = c("crew", "mirai"), + meta = mock_meta_packages_graph + ), + list( + crew.aws.batch = list(crew = character(0L), mirai = "crew"), + crew.cluster = list(crew = character(0L), mirai = "crew"), + crew = list(mirai = character(0L)) + ) + ) +}) + +test_that("issues_dependencies() with more than one direct dependency", { + meta <- mock_meta_packages_graph + row <- meta[meta$package == "crew", ] + row$package <- "x" + meta <- rbind(meta, row) + meta[["_dependencies"]][meta$package == "crew.aws.batch"][[1L]] <- rbind( + meta[["_dependencies"]][meta$package == "crew.aws.batch"][[1L]], + data.frame(package = "x", version = NA_character_, role = "Imports") + ) + expect_equal( + issues_dependencies(packages = "mirai", meta = meta), + list( + crew = list(mirai = character(0L)), + x = list(mirai = character(0L)), + crew.aws.batch = list(mirai = c("crew", "x")), + crew.cluster = list(mirai = "crew") + ) + ) +}) + +test_that("issues_dependencies() with more than one direct dependency (2)", { + meta <- mock_meta_packages_graph + row <- meta[meta$package == "crew", ] + row$package <- "x" + meta <- rbind(meta, row) + meta[["_dependencies"]][meta$package == "crew.aws.batch"][[1L]] <- rbind( + meta[["_dependencies"]][meta$package == "crew.aws.batch"][[1L]], + data.frame(package = "x", version = NA_character_, role = "Imports") + ) + expect_equal( + issues_dependencies(packages = c("mirai", "nanonext"), meta = meta), + list( + crew = list(mirai = character(0L), nanonext = "mirai"), + x = list(mirai = character(0L), nanonext = "mirai"), + crew.aws.batch = list( + mirai = c("crew", "x"), + nanonext = c("crew", "x") + ), + crew.cluster = list( + mirai = "crew", + nanonext = "crew" + ), + mirai = list(nanonext = character(0L)) + ) + ) +}) From 4ee119d520907c544491320b4132ef26ac573c0a Mon Sep 17 00:00:00 2001 From: wlandau Date: Mon, 10 Jun 2024 14:03:04 -0400 Subject: [PATCH 03/17] Filter out nonexistent vertices --- NAMESPACE | 1 + R/issues_dependencies.R | 3 ++- R/package.R | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index b0afedc..3f73884 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -17,6 +17,7 @@ export(review_pull_request) export(review_pull_requests) export(try_message) importFrom(gh,gh) +importFrom(igraph,V) importFrom(igraph,graph) importFrom(igraph,neighbors) importFrom(igraph,subcomponent) diff --git a/R/issues_dependencies.R b/R/issues_dependencies.R index 354de1c..fbffc6d 100644 --- a/R/issues_dependencies.R +++ b/R/issues_dependencies.R @@ -38,8 +38,9 @@ #' issues_dependencies(packages = c("crew", "mirai"), meta = meta) issues_dependencies <- function(packages, meta) { graph <- issues_dependencies_graph(meta) + vertices <- names(igraph::V(graph)) issues <- list() - for (package in packages) { + for (package in intersect(packages, vertices)) { revdeps <- names(igraph::subcomponent(graph, v = package, mode = "out")) revdeps <- setdiff(revdeps, package) for (revdep in revdeps) { diff --git a/R/package.R b/R/package.R index 4ae068d..17a6ed4 100644 --- a/R/package.R +++ b/R/package.R @@ -1,5 +1,5 @@ #' @importFrom gh gh -#' @importFrom igraph graph neighbors subcomponent +#' @importFrom igraph graph neighbors subcomponent V #' @importFrom jsonlite parse_json read_json stream_in write_json #' @importFrom nanonext ncurl parse_url status_code #' @importFrom pkgsearch cran_package From f6328b80399521d58efe79730b681d8dbcdc85d6 Mon Sep 17 00:00:00 2001 From: wlandau Date: Mon, 10 Jun 2024 14:03:46 -0400 Subject: [PATCH 04/17] doc --- R/issues_dependencies.R | 2 +- man/issues_dependencies.Rd | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/R/issues_dependencies.R b/R/issues_dependencies.R index fbffc6d..bd06f91 100644 --- a/R/issues_dependencies.R +++ b/R/issues_dependencies.R @@ -26,7 +26,7 @@ #' The choice in output format from [issues_dependencies()] allows package #' maintainers to more easily figure out which direct dependencies #' are contributing issues and drop those direct dependencies if necessary. -#' @param names Names of packages with other issues. +#' @param packages Character vector of names of packages with other issues. #' @param meta A data frame with R-universe package check results #' returned by [meta_checks()]. #' @examples diff --git a/man/issues_dependencies.Rd b/man/issues_dependencies.Rd index 51b3d68..8af4da9 100644 --- a/man/issues_dependencies.Rd +++ b/man/issues_dependencies.Rd @@ -7,10 +7,10 @@ issues_dependencies(packages, meta) } \arguments{ +\item{packages}{Character vector of names of packages with other issues.} + \item{meta}{A data frame with R-universe package check results returned by \code{\link[=meta_checks]{meta_checks()}}.} - -\item{names}{Names of packages with other issues.} } \value{ A nested list of problems triggered by dependencies. From a5dc1e9606786864b791f8ff452cb8a834a6ed39 Mon Sep 17 00:00:00 2001 From: wlandau Date: Mon, 10 Jun 2024 14:12:55 -0400 Subject: [PATCH 05/17] test record_versions() with dependency graph --- tests/testthat/test-record_issues.R | 106 ++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) diff --git a/tests/testthat/test-record_issues.R b/tests/testthat/test-record_issues.R index ff2db97..6688158 100644 --- a/tests/testthat/test-record_issues.R +++ b/tests/testthat/test-record_issues.R @@ -168,3 +168,109 @@ test_that("record_issues() on a small repo", { ) expect_true(dir.exists(output)) }) + +test_that("record_issues() with dependency problems", { + output <- tempfile() + lines <- c( + "[", + " {", + " \"package\": \"nanonext\",", + " \"version_current\": \"1.0.0\",", + " \"hash_current\": \"hash_1.0.0-modified\",", + " \"version_highest\": \"1.0.0\",", + " \"hash_highest\": \"hash_1.0.0\"", + " }", + "]" + ) + versions <- tempfile() + writeLines(lines, versions) + meta_checks <- mock_meta_checks[1L, ] + meta_checks$package <- "crew" + meta_checks[["_winbinary"]] <- "failure" + record_issues( + versions = versions, + mock = list( + checks = meta_checks, + packages = mock_meta_packages_graph, + today = "2024-01-01" + ), + output = output + ) + expect_true(dir.exists(output)) + expect_equal( + jsonlite::read_json( + file.path(output, "nanonext"), + simplifyVector = TRUE + ), + list( + versions = list( + version_current = "1.0.0", + hash_current = "hash_1.0.0-modified", + version_highest = "1.0.0", + hash_highest = "hash_1.0.0" + ), + date = "2024-01-01" + ) + ) + expect_equal( + jsonlite::read_json( + file.path(output, "mirai"), + simplifyVector = TRUE + ), + list( + dependencies = list( + nanonext = list() + ), + date = "2024-01-01" + ) + ) + expect_equal( + jsonlite::read_json( + file.path(output, "crew"), + simplifyVector = TRUE + ), + list( + checks = list( + "_linuxdevel" = "success", + "_macbinary" = "success", + "_wasmbinary" = "success", + "_winbinary" = "failure", + "_status" = "success", + "_buildurl" = file.path( + "https://github.com/r-universe/r-multiverse/actions", + "runs/8998731783" + ) + ), + dependencies = list( + nanonext = "mirai" + ), + date = "2024-01-01" + ) + ) + expect_equal( + jsonlite::read_json( + file.path(output, "crew.aws.batch"), + simplifyVector = TRUE + ), + list( + dependencies = list( + crew = list(), + nanonext = "crew" + ), + date = "2024-01-01" + ) + ) + expect_equal( + jsonlite::read_json( + file.path(output, "crew.cluster"), + simplifyVector = TRUE + ), + list( + dependencies = list( + crew = list(), + nanonext = "crew" + ), + date = "2024-01-01" + ) + ) +}) From 76cd3879dc134641d429b879da0e9de8e9ba1533 Mon Sep 17 00:00:00 2001 From: wlandau Date: Mon, 10 Jun 2024 14:45:21 -0400 Subject: [PATCH 06/17] recompute mocks --- R/record_issues.R | 24 +- tests/testthat/helper-mock.R | 607 ++++++++++++++++++++++++++++++----- 2 files changed, 549 insertions(+), 82 deletions(-) diff --git a/R/record_issues.R b/R/record_issues.R index e4ef3ef..d8b651d 100644 --- a/R/record_issues.R +++ b/R/record_issues.R @@ -69,7 +69,12 @@ record_issues <- function( add_issues(issues_versions(versions = versions), "versions") issues <- issues |> add_issues(issues_dependencies(names(issues), packages), "dependencies") - overwrite_issues(issues = issues, output = output, today = today) + overwrite_issues( + issues = issues, + output = output, + today = today, + packages = packages + ) invisible() } @@ -80,15 +85,15 @@ add_issues <- function(total, subset, category) { total } -overwrite_issues <- function(issues, output, today) { - packages <- list.files(output) +overwrite_issues <- function(issues, output, today, packages) { + with_issues <- list.files(output) dates <- lapply( - X = packages, + X = with_issues, FUN = function(path) { jsonlite::read_json(file.path(output, path), simplifyVector = TRUE)$date } ) - names(dates) <- packages + names(dates) <- with_issues unlink(output, recursive = TRUE) dir.create(output) lapply( @@ -97,7 +102,8 @@ overwrite_issues <- function(issues, output, today) { issues = issues, output = output, today = today, - dates = dates + dates = dates, + packages = packages ) } @@ -106,10 +112,14 @@ overwrite_package_issues <- function( issues, output, today, - dates + dates, + packages ) { path <- file.path(output, package) issues[[package]]$date <- dates[[package]] %||% today + index <- packages$package == package + issues[[package]]$version <- packages[["version"]][index] + issues[[package]]$remote_hash <- packages[["remotesha"]][index] jsonlite::write_json( x = issues[[package]], path = file.path(output, package), diff --git a/tests/testthat/helper-mock.R b/tests/testthat/helper-mock.R index 0095278..bccf399 100644 --- a/tests/testthat/helper-mock.R +++ b/tests/testthat/helper-mock.R @@ -2,133 +2,590 @@ mock_meta_checks <- structure( list( package = c( - "tinytest", "tidytensor", "secretbase", - "multiverse.internals", "SBC", "duckdb", "httpgd", "targetsketch", - "stantargets", "zstdlite", "INLA", "audio.whisper", "tidypolars", - "multitools", "audio.vadwebrtc", "nanonext", "polars", "cmdstanr", - "string2path" + "zstdlite", "multiverse.internals", + "cmdstanr", "tinytest", "tidypolars", "duckdb", "polars", "secretbase", + "audio.whisper", "ichimoku", "string2path", + "tidytensor", "audio.vadwebrtc", + "stantargets", "mirai", "INLA", "multitools", "SBC", "httpgd", + "nanonext", "targetsketch" ), "_user" = c( - "r-multiverse", "r-multiverse", "r-multiverse", + "r-multiverse", "r-multiverse", "r-multiverse", "r-multiverse", "r-multiverse", "r-multiverse", "r-multiverse", "r-multiverse", "r-multiverse", "r-multiverse", "r-multiverse", "r-multiverse", "r-multiverse", "r-multiverse", - "r-multiverse", "r-multiverse", "r-multiverse", "r-multiverse" + "r-multiverse", "r-multiverse", "r-multiverse", "r-multiverse", + "r-multiverse", "r-multiverse", "r-multiverse" ), "_type" = c( - "src", "src", "src", "src", "src", "src", "src", - "src", "src", "src", "failure", "src", "src", "src", "src", "src", - "src", "src", "src" + "src", + "src", "src", "src", "src", "src", "src", "src", "src", "src", + "src", "src", "src", "src", "src", "failure", "src", "src", "src", + "src", "src" ), "_status" = c( - "success", "failure", "success", - "success", "failure", "success", "success", "success", "success", - "success", NA, "success", "success", "success", "success", "success", - "success", "success", "success" + "success", "success", "success", + "success", "success", "success", "success", "success", "success", + "success", "success", "failure", "success", "success", "success", + NA, "success", "failure", "success", "success", "success" ), "_winbinary" = c( - "success", "success", "success", "success", - "success", "success", "success", - "success", "success", "success", NA, "success", "success", "success", - "success", "success", "success", "success", "success" + "success", + "success", "success", "success", "success", "success", "success", + "success", "success", "success", "success", "success", "success", + "success", "success", NA, "success", "success", "success", "success", + "success" ), "_macbinary" = c( - "success", "success", "success", "success", "success", "success", "success", - "success", "success", "success", NA, "success", "success", "success", - "success", "success", "arm64-failure", "success", "success" + "success", "success", "success", "arm64-failure", "success", + "success", "success", "success", "success", "success", "success", + "success", NA, "success", "success", "success", "success", "success" ), "_wasmbinary" = c( "success", "success", "success", "success", "success", "success", "none", "success", "success", "success", - NA, "success", "success", "success", "success", "success", - "none", "success", "none" + "success", "success", "success", "success", "success", NA, "success", + "success", "none", "success", "success" ), "_linuxdevel" = c( - "success", "failure", "success", "success", - "failure", "success", "success", - "success", "failure", "success", NA, - "success", "success", - "success", "success", "success", - "failure", "success", "success" + "success", + "success", "success", "success", "success", "success", "failure", + "success", "success", "success", "success", "failure", "success", + "failure", "success", NA, "success", "failure", "success", "success", + "success" ), "_buildurl" = c( - "https://github.com/r-universe/r-multiverse/actions/runs/8998731783", - "https://github.com/r-universe/r-multiverse/actions/runs/8998732025", - "https://github.com/r-universe/r-multiverse/actions/runs/8998731915", - "https://github.com/r-universe/r-multiverse/actions/runs/8998732064", - "https://github.com/r-universe/r-multiverse/actions/runs/8998731731", - "https://github.com/r-universe/r-multiverse/actions/runs/8998731753", - "https://github.com/r-universe/r-multiverse/actions/runs/8998732459", - "https://github.com/r-universe/r-multiverse/actions/runs/8998732171", - "https://github.com/r-universe/r-multiverse/actions/runs/8998732490", - "https://github.com/r-universe/r-multiverse/actions/runs/8998732389", - "https://github.com/r-universe/r-multiverse/actions/runs/8487512222", - "https://github.com/r-universe/r-multiverse/actions/runs/8998732607", - "https://github.com/r-universe/r-multiverse/actions/runs/8998732444", - "https://github.com/r-universe/r-multiverse/actions/runs/8998731870", - "https://github.com/r-universe/r-multiverse/actions/runs/8998732026", - "https://github.com/r-universe/r-multiverse/actions/runs/8998732176", - "https://github.com/r-universe/r-multiverse/actions/runs/9005231218", - "https://github.com/r-universe/r-multiverse/actions/runs/9140511697", - "https://github.com/r-universe/r-multiverse/actions/runs/8998732437" + "https://github.com/r-universe/r-multiverse/actions/runs/9412009683", + "https://github.com/r-universe/r-multiverse/actions/runs/9420167853", + "https://github.com/r-universe/r-multiverse/actions/runs/9407999221", + "https://github.com/r-universe/r-multiverse/actions/runs/9352924033", + "https://github.com/r-universe/r-multiverse/actions/runs/9364583983", + "https://github.com/r-universe/r-multiverse/actions/runs/9412010159", + "https://github.com/r-universe/r-multiverse/actions/runs/9360739181", + "https://github.com/r-universe/r-multiverse/actions/runs/9412009508", + "https://github.com/r-universe/r-multiverse/actions/runs/9412009855", + "https://github.com/r-universe/r-multiverse/actions/runs/9423785225", + "https://github.com/r-universe/r-multiverse/actions/runs/9326435602", + "https://github.com/r-universe/r-multiverse/actions/runs/9412009544", + "https://github.com/r-universe/r-multiverse/actions/runs/9412009640", + "https://github.com/r-universe/r-multiverse/actions/runs/9412009826", + "https://github.com/r-universe/r-multiverse/actions/runs/9423785674", + "https://github.com/r-universe/r-multiverse/actions/runs/9296256187", + "https://github.com/r-universe/r-multiverse/actions/runs/9288035966", + "https://github.com/r-universe/r-multiverse/actions/runs/9412009979", + "https://github.com/r-universe/r-multiverse/actions/runs/9403635056", + "https://github.com/r-universe/r-multiverse/actions/runs/9354527129", + "https://github.com/r-universe/r-multiverse/actions/runs/9412009721" ), "_indexed" = c( - FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, - FALSE, TRUE, FALSE, FALSE, NA, TRUE, TRUE, TRUE, FALSE, FALSE, - TRUE, TRUE, FALSE + FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, + FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NA, TRUE, + FALSE, FALSE, FALSE, FALSE ), "_binaries" = list( - list(), list(), list(), - list(), list(), list(), list(), list(), list(), list(), - list(), list(), list(), list(), list(), list(), list(), - list(), list() + list(), list(), + list(), list(), list(), list(), list(), list(), list(), list(), + list(), list(), list(), list(), list(), list(), list(), list(), + list(), list(), list() ), "_failure" = structure( list( buildurl = c( - NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, - paste0( + NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, + file.path( "https://github.com/r-universe/r-multiverse", - "/actions/runs/8487512222" + "actions/runs/9296256187" ), - NA, NA, NA, NA, NA, NA, NA, NA + NA, NA, NA, NA, NA ) ), class = "data.frame", - row.names = c(NA, 19L) + row.names = c(NA, 21L) ) ), class = "data.frame", - row.names = c(NA, 19L) + row.names = c(NA, 21L) ) -# parse(text = deparse(meta_packages(repo = "https://multiverse.r-multiverse.org")) # nolint +# parse(text = deparse(meta_packages(repo = "https://multiverse.r-multiverse.org"))) # nolint mock_meta_packages <- structure( list( + "_id" = c( + "6662a46b4e86770016655c87", "6662991c4e867700166503e4", + "66629ac44e86770016650d77", "66622a203f30cb0016a5dc6d", + "6662a8364e86770016656250", + "6661d73b3f30cb0016a57149", "666389894e86770016666b7a", + "666389434e86770016666b5a", + "66573e0457bd700012b52712", "666336054e86770016663cda", + "665dfd23adaeeb0016e158be", + "665e8c08ccc2e30016c0516a", "666298b94e86770016650285", + "66629a064e86770016650798", + "665a79f9f99f020014971e1e", "666299ca4e867700166506e7", + "665edf19ccc2e30016c1797b", + "666299114e86770016650371", "665de13afb25640016cf701f", + "666299d34e8677001665074b" + ), package = c( - "SBC", "audio.vadwebrtc", "audio.whisper", - "cmdstanr", "duckdb", "httpgd", "multitools", "multiverse.internals", - "nanonext", "polars", "secretbase", "stantargets", "string2path", + "SBC", "audio.vadwebrtc", "audio.whisper", "cmdstanr", + "duckdb", "httpgd", "ichimoku", "mirai", "multitools", "multiverse.internals", + "nanonext", "polars", "secretbase", "stantargets", "string2path", "targetsketch", "tidypolars", "tidytensor", "tinytest", "zstdlite" ), version = c( - "0.3.0.9000", "0.2", "0.4.1", "0.8.0", "0.10.1", - "2.0.1", "0.1.0", "0.1.4", "1.0.0", "0.16.4", "0.5.0", "0.1.1", - "0.1.6", "0.0.1", "0.7.0", "1.0.0", "1.4.1.1", "0.2.6" + "0.3.0.9000", "0.2", "0.4.1", "0.8.1", "0.10.1", + "2.0.2", "1.5.2", "1.1.0", "0.1.1", "0.2.1", "1.1.0", "0.17.0", + "0.5.0", "0.1.1", "0.1.7", "0.0.1", "0.8.0", "1.0.0", "1.4.1.1", + "0.2.6" + ), + license = c( + "MIT + file LICENSE", "MPL-2.0", "MIT + file LICENSE", + "BSD_3_clause + file LICENSE", "MIT + file LICENSE", "GPL (>= 2)", + "GPL (>= 3)", "GPL (>= 3)", "MIT + file LICENSE", "MIT + file LICENSE", + "GPL (>= 3)", "MIT + file LICENSE", "GPL (>= 3)", "MIT + file LICENSE", + "MIT + file LICENSE", "MIT + file LICENSE", "MIT + file LICENSE", + "MIT + file LICENSE", "GPL-3", "MIT + file LICENSE" + ), + remotesha = c( + "9ddc803105f5350dae6efb4ae2657e89d2a54aa8", + "c3de76ddc738dbb4a80ac7ec67ac9da3cba093ba", + "4b5c6a288c0f46a4cdc47f50d2d35395d3e32194", + "02259ef7aa2a8b1c8de2fa3fc42a9feafd789288", + "498dc55b9ec48c016de9e99ebb4fadf3c0177949", + "b0a5ec38638ca69e3adbc7b24d815757e5f74817", + "794e514da2ed6ff94ebe95b970c2434999d632a8", + "049e750168363e80d5d0915d0de9fd515c20f628", + "c73b933868d8c6884df4220c25779cd0874ec7de", + "d4740609df6ee38bcf09d1e91691286af23c1b1f", + "54c1637c74e7941fbe9f152df70c0a25f8cd37f6", + "038d5ce10afe592ecc197902f661509481c1d143", + "80cbbd9840091a1e67a99db255cb89b22ee9e0b6", + "bbdda1b4a44a3d6a22041e03eed38f27319d8f32", + "38ce124866879d485f667b7bf3d2a070e6cb37d3", + "a199a734b16f91726698a19e5f147f57f79cb2b6", + "7e6e3f7ce76abd960c49ef46cc3f4bf1cc8b0637", + "14f5b87d2dfae20eb35cfd974adf660a4fd89980", + "b2c15f2033a04cd0d5da25aa5ac0c27adc296a47", + "585458ccbe36eaa179d8b30f04f1e3a91dc6b993" + ), + needscompilation = c( + "no", + "yes", "yes", "no", "yes", "yes", "yes", "no", "no", "no", "yes", + "yes", "yes", "no", "yes", "no", "no", "no", "no", "yes"), + md5sum = c( + "7e4c4e683057904821a335dc7bc75fd1", + "111a032d82ccf648be06559cd023022d", "20667588d9037d3bc9e632c2d34b56da", + "1d75cc5e11f05fd8a04981c32bce19a1", "c48e76fa587b7783ae154b52d082456c", + "3663b4618478c1298500a11b5e89aea3", "4bbd715cc6cb3a82f7befc929df6d03d", + "cbe8ac6c9e826bc9714d7e7b2d050c13", "1857661573200eba4db7603cbd1d8af3", + "471b6bde16d3edea7019a46326f3987a", "1f8cd6b292ce88e32112f8dc145e9241", + "26a1388aa633d6dd8dd580f6a6947ce7", "d0a8befb8275606f970ad4f42b39578d", + "60f182d9d6cd4dea7e98799ec8b8dea6", "a8f69782953706816a1f6b8d00f9d49e", + "58e478144e6b35029fafb6230755d895", "6410fcc22099bce823b2be379243bb21", + "3f18e78dffa3e45863e95aeb683aa08b", "7e8e297f00058b895d75201f31e65812", + "31c8eed8564835a1d83b8115c71dfdf4" + ), + "_type" = c( + "src", "src", + "src", "src", "src", "src", "src", "src", "src", "src", "src", + "src", "src", "src", "src", "src", "src", "src", "src", "src" + ), + "_dependencies" = list( + structure( + list( + package = c( + "R6", "posterior", + "ggplot2", "stats", "stringi", "abind", "future.apply", "dplyr", + "tidyr", "tidyselect", "purrr", "memoise", "testthat", "cmdstanr", + "rstan", "knitr", "rmarkdown", "brms", "MCMCpack", "medicaldata", + "formula.tools", "MASS", "mvtnorm", "patchwork", "bayesplot" + ), + role = c("Imports", "Imports", "Imports", "Imports", "Imports", + "Imports", "Imports", "Imports", + "Imports", "Imports", "Imports", + "Imports", "Suggests", "Suggests", "Suggests", "Suggests", + "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", + "Suggests", "Suggests", "Suggests", "Suggests" + ), + version = c(NA, + ">= 1.0.0", NA, NA, NA, NA, NA, NA, NA, + NA, NA, NA, NA, ">= 0.4.0", + NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA + ) + ), + class = "data.frame", + row.names = c(NA, 25L) + ), + structure( + list( + package = c( + "R", "Rcpp", "abseil", "Rcpp", + "utils", "av", "audio" + ), + version = c( + ">= 2.10", NA, NA, ">= 0.11.5", + NA, NA, NA + ), + role = c( + "Depends", "LinkingTo", "LinkingTo", "Imports", + "Imports", "Suggests", "Suggests" + ) + ), + class = "data.frame", + row.names = c(NA, 7L) + ), + structure( + list( + package = c( + "R", "Rcpp", "Rcpp", "utils", + "tinytest", "audio", "data.table", "audio.vadwebrtc" + ), + version = c( + ">= 2.10", NA, ">= 0.11.5", NA, NA, NA, ">= 1.12.4", ">= 0.2.0" + ), + role = c( + "Depends", "LinkingTo", "Imports", "Imports", + "Suggests", "Suggests", "Suggests", + "Suggests" + ) + ), + class = "data.frame", + row.names = c(NA, 8L) + ), + structure( + list( + package = c( + "R", "checkmate", "data.table", "jsonlite", "posterior", + "processx", "R6", "withr", "rlang", "bayesplot", "ggplot2", + "knitr", "loo", "rmarkdown", "testthat", "Rcpp" + ), + version = c( + ">= 3.5.0", NA, NA, ">= 1.2.0", ">= 1.4.1", + ">= 3.5.0", ">= 2.4.0", ">= 2.5.0", + ">= 0.4.7", NA, NA, ">= 1.37", ">= 2.0.0", NA, ">= 2.1.0", NA + ), + role = c( + "Depends", "Imports", "Imports", "Imports", + "Imports", "Imports", "Imports", "Imports", "Imports", "Suggests", + "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", + "Suggests" + ) + ), + class = "data.frame", + row.names = c(NA, 16L) + ), + structure( + list( + package = c( + "DBI", "R", "methods", "utils", + "adbcdrivermanager", "arrow", "bit64", + "callr", "DBItest", "dbplyr", + "dplyr", "rlang", "testthat", "tibble", "vctrs", "withr" + ), + role = c( + "Depends", "Depends", "Imports", "Imports", + "Suggests", "Suggests", "Suggests", + "Suggests", "Suggests", "Suggests", + "Suggests", "Suggests", "Suggests", + "Suggests", "Suggests", "Suggests" + ), + version = c( + NA, ">= 3.6.0", NA, NA, NA, ">= 13.0.0", + NA, NA, NA, NA, NA, NA, NA, NA, NA, + NA + ) + ), + class = "data.frame", + row.names = c(NA, 16L) + ), + structure( + list( + package = c( + "R", "unigd", "cpp11", "AsioHeaders", "unigd", + "testthat", "xml2", "knitr", "rmarkdown", "covr", "future", + "httr", "jsonlite" + ), + version = c( + ">= 3.2.0", NA, ">= 0.2.4", + ">= 1.22.1", NA, NA, ">= 1.0.0", NA, NA, NA, NA, NA, NA + ), + role = c( + "Depends", "LinkingTo", "LinkingTo", "LinkingTo", + "Imports", "Suggests", "Suggests", "Suggests", "Suggests", + "Suggests", "Suggests", "Suggests", "Suggests" + ) + ), + class = "data.frame", + row.names = c(NA, 13L) + ), + structure( + list( + package = c( + "R", "RcppSimdJson", "xts", "ggplot2", + "mirai", "nanonext", "RcppSimdJson", "secretbase", + "shiny", "xts", "zoo", "keyring", "knitr", "rmarkdown", "testthat" + ), + version = c( + ">= 3.5", NA, NA, ">= 3.4.0", ">= 1.0.0", ">= 1.0.0", + ">= 0.1.9", ">= 0.3.0", ">= 1.4.0", NA, NA, NA, NA, NA, ">= 3.0.0" + ), + role = c( + "Depends", "LinkingTo", "LinkingTo", "Imports", "Imports", + "Imports", "Imports", "Imports", "Imports", "Imports", "Imports", + "Suggests", "Suggests", "Suggests", "Suggests" + ) + ), + class = "data.frame", + row.names = c(NA, 15L)), + structure( + list( + package = c( + "R", "nanonext", "knitr", "markdown", "parallel", "promises" + ), + version = c(">= 3.6", ">= 1.1.0", NA, NA, NA, NA), + role = c( + "Depends", "Imports", "Suggests", "Suggests", + "Enhances", "Enhances" + ) + ), + class = "data.frame", row.names = c(NA, 6L) + ), + structure( + list( + package = c( + "R", "jsonlite", "tibble", "curl", + "knitr", "markdown", "rmarkdown", "testthat" + ), + version = c( + ">= 4.0.0", + NA, NA, NA, ">= 1.30", ">= 1.1", ">= 2.4", ">= 3.0.0" + ), + role = c( + "Depends", + "Imports", "Imports", "Suggests", + "Suggests", "Suggests", "Suggests", + "Suggests" + ) + ), + class = "data.frame", + row.names = c(NA, 8L) + ), + structure( + list( + package = c( + "R", "gh", "jsonlite", "nanonext", "pkgsearch", + "utils", "vctrs", "testthat" + ), + version = c( + ">= 3.5.0", NA, + NA, NA, NA, NA, NA, ">= 3.0.0" + ), + role = c( + "Depends", "Imports", + "Imports", "Imports", "Imports", "Imports", "Imports", "Suggests" + ) + ), + class = "data.frame", + row.names = c(NA, 8L) + ), + structure( + list( + package = c("R", "later", "later", "knitr", "markdown"), + version = c(">= 3.5", NA, NA, NA, NA), + role = c( + "Depends", + "LinkingTo", "Imports", "Suggests", "Suggests" + ) + ), + class = "data.frame", + row.names = c(NA, 5L) + ), + structure( + list( + package = c( + "R", "utils", "codetools", "methods", + "arrow", "bench", "bit64", "callr", "clock", "curl", "ggplot2", + "jsonlite", "knitr", "lubridate", "nanoarrow", "nycflights13", + "patrick", "pillar", "rlang", "rmarkdown", "testthat", "tibble", + "tools", "vctrs", "withr" + ), + version = c( + ">= 4.2", NA, NA, NA, + ">= 15.0.1", NA, NA, NA, ">= 0.7.0", + NA, NA, NA, NA, NA, ">= 0.4.0", + NA, NA, NA, NA, NA, ">= 3.2.1", NA, NA, NA, NA + ), + role = c( + "Depends", + "Imports", "Imports", "Imports", + "Suggests", "Suggests", "Suggests", + "Suggests", "Suggests", "Suggests", + "Suggests", "Suggests", "Suggests", + "Suggests", "Suggests", "Suggests", + "Suggests", "Suggests", "Suggests", + "Suggests", "Suggests", "Suggests", + "Suggests", "Suggests", "Suggests" + ) + ), + class = "data.frame", + row.names = c(NA, 25L) + ), + structure( + list( + package = "R", + version = ">= 3.5", + role = "Depends" + ), + class = "data.frame", + row.names = 1L + ), + structure( + list( + package = c( + "R", "cmdstanr", "fs", "fst", + "posterior", "purrr", "qs", "rlang", "secretbase", "stats", + "targets", "tarchetypes", "tibble", "tidyselect", "withr", + "dplyr", "ggplot2", "knitr", "R.utils", "rmarkdown", "SBC", + "testthat", "tidyr", "visNetwork" + ), + version = c( + ">= 3.5.0", + ">= 0.5.0", ">= 1.5.0", ">= 0.9.2", ">= 1.0.1", ">= 0.3.4", + ">= 0.23.2", ">= 0.4.10", ">= 0.4.0", NA, ">= 1.6.0", ">= 0.8.0", + ">= 3.0.1", NA, ">= 2.1.2", ">= 1.0.2", ">= 3.0.0", ">= 1.30", + ">= 2.10.1", ">= 2.3", ">= 0.2.0", ">= 3.0.0", ">= 1.0.0", + ">= 2.0.9" + ), + role = c( + "Depends", "Imports", "Imports", "Imports", + "Imports", "Imports", "Imports", "Imports", "Imports", "Imports", + "Imports", "Imports", "Imports", "Imports", "Imports", "Suggests", + "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", + "Suggests", "Suggests", "Suggests" + ) + ), + class = "data.frame", + row.names = c(NA, 24L) + ), + structure( + list( + package = c("R", "tibble", "cli", "testthat"), + version = c(">= 4.2", NA, NA, ">= 3.0.0"), + role = c("Depends", "Imports", "Imports", "Suggests") + ), + class = "data.frame", + row.names = c(NA, 4L) + ), + structure( + list( + package = c( + "R", "bs4Dash", "DT", "htmltools", + "markdown", "rclipboard", "shiny", "shinyalert", "shinyAce", + "shinybusy", "shinycssloaders", "shinyFiles", "targets", + "tarchetypes", "visNetwork", "withr", "pkgload", "rmarkdown" + ), + version = c( + ">= 4.1.0", ">= 2.0.0", ">= 0.14", ">= 0.5.0", + NA, NA, ">= 1.5.0", ">= 1.1", ">= 0.4.1", ">= 0.2.0", ">= 0.3", + ">= 0.9.3", ">= 0.2.0", ">= 0.1.0", ">= 2.0.9", ">= 2.2.0", + ">= 1.1.0", ">= 2.3" + ), + role = c( + "Depends", "Imports", "Imports", + "Imports", "Imports", "Imports", "Imports", "Imports", "Imports", + "Imports", "Imports", "Imports", "Imports", "Imports", "Imports", + "Imports", "Suggests", "Suggests" + ) + ), + class = "data.frame", + row.names = c(NA, 18L) + ), + structure( + list( + package = c( + "R", "dplyr", "glue", "polars", + "rlang", "tidyr", "tidyselect", "utils", "vctrs", "bench", + "data.table", "knitr", "lubridate", "rmarkdown", "rstudioapi", + "tibble", "tinytest" + ), + version = c( + ">= 4.1.0", NA, NA, ">= 0.17.0", + NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA + ), + role = c( + "Depends", + "Imports", "Imports", "Imports", "Imports", "Imports", "Imports", + "Imports", "Imports", "Suggests", "Suggests", "Suggests", + "Suggests", "Suggests", "Suggests", "Suggests", "Suggests" + ) + ), + class = "data.frame", + row.names = c(NA, 17L) + ), + structure( + list( + package = c( + "abind", "purrr", "rstackdeque", "magrittr", + "rlang", "tidyselect", "testthat", "reticulate", "stringr", + "keras", "dplyr", "covr", "knitr", "markdown", "ggplot2", + "tidyr" + ), + role = c( + "Imports", "Imports", "Imports", "Imports", + "Imports", "Imports", "Suggests", "Suggests", "Suggests", + "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", + "Suggests", "Suggests" + ) + ), + class = "data.frame", + row.names = c(NA, 16L) + ), + structure( + list( + package = c("R", "parallel", "utils"), + version = c(">= 3.0.0", NA, NA), + role = c( + "Depends", "Imports", + "Imports" + ) + ), + class = "data.frame", + row.names = c(NA, 3L) + ), + structure( + list( + package = c( + "R", "knitr", "rmarkdown", "testthat", + "bench" + ), + version = c(">= 3.4.0", NA, NA, NA, NA), + role = c( + "Depends", + "Suggests", "Suggests", "Suggests", "Suggests" + ) + ), + class = "data.frame", + row.names = c(NA, 5L) + ) + ), + distro = c( + "noble", "noble", "noble", "noble", "noble", + "noble", "noble", "noble", "noble", "noble", "noble", "noble", + "noble", "noble", "noble", "noble", "noble", "noble", "noble", + "noble" ), remotes = list( - NULL, NULL, "bnosac/audio.vadwebrtc", NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - c("hyunjimoon/SBC", "stan-dev/cmdstanr", ""), - NULL, NULL, "markvanderloo/tinytest/pkg", NULL, NULL, NULL + NULL, NULL, "bnosac/audio.vadwebrtc", + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + c("hyunjimoon/SBC", "stan-dev/cmdstanr", ""), NULL, NULL, + "markvanderloo/tinytest/pkg", NULL, NULL, NULL ) ), - row.names = c(NA, 18L), - class = "data.frame" + class = "data.frame", + row.names = c(NA, 20L) ) -# parse(text = deparse(meta_packages(repo = "https://wlandau.r-universe.dev")) # nolint +# parse(text = deparse(meta_packages(repo = "https://wlandau.r-universe.dev"))) # nolint mock_meta_packages_graph <- structure( list( "_id" = c( From 8e09359278ceb6afa5a00a929783debd3725ef8f Mon Sep 17 00:00:00 2001 From: wlandau Date: Mon, 10 Jun 2024 14:49:58 -0400 Subject: [PATCH 07/17] linting --- tests/testthat/helper-mock.R | 305 ++++++++++++++++++----------------- 1 file changed, 155 insertions(+), 150 deletions(-) diff --git a/tests/testthat/helper-mock.R b/tests/testthat/helper-mock.R index bccf399..a1e842c 100644 --- a/tests/testthat/helper-mock.R +++ b/tests/testthat/helper-mock.R @@ -112,105 +112,109 @@ mock_meta_checks <- structure( mock_meta_packages <- structure( list( "_id" = c( - "6662a46b4e86770016655c87", "6662991c4e867700166503e4", + "6662a46b4e86770016655c87", "6662991c4e867700166503e4", "66629ac44e86770016650d77", "66622a203f30cb0016a5dc6d", - "6662a8364e86770016656250", + "6662a8364e86770016656250", "6661d73b3f30cb0016a57149", "666389894e86770016666b7a", - "666389434e86770016666b5a", + "666389434e86770016666b5a", "66573e0457bd700012b52712", "666336054e86770016663cda", - "665dfd23adaeeb0016e158be", + "665dfd23adaeeb0016e158be", "665e8c08ccc2e30016c0516a", "666298b94e86770016650285", - "66629a064e86770016650798", + "66629a064e86770016650798", "665a79f9f99f020014971e1e", "666299ca4e867700166506e7", - "665edf19ccc2e30016c1797b", + "665edf19ccc2e30016c1797b", "666299114e86770016650371", "665de13afb25640016cf701f", "666299d34e8677001665074b" ), package = c( - "SBC", "audio.vadwebrtc", "audio.whisper", "cmdstanr", - "duckdb", "httpgd", "ichimoku", "mirai", "multitools", "multiverse.internals", - "nanonext", "polars", "secretbase", "stantargets", "string2path", + "SBC", "audio.vadwebrtc", "audio.whisper", "cmdstanr", + "duckdb", "httpgd", "ichimoku", "mirai", + "multitools", "multiverse.internals", + "nanonext", "polars", "secretbase", "stantargets", "string2path", "targetsketch", "tidypolars", "tidytensor", "tinytest", "zstdlite" ), version = c( - "0.3.0.9000", "0.2", "0.4.1", "0.8.1", "0.10.1", - "2.0.2", "1.5.2", "1.1.0", "0.1.1", "0.2.1", "1.1.0", "0.17.0", - "0.5.0", "0.1.1", "0.1.7", "0.0.1", "0.8.0", "1.0.0", "1.4.1.1", + "0.3.0.9000", "0.2", "0.4.1", "0.8.1", "0.10.1", + "2.0.2", "1.5.2", "1.1.0", "0.1.1", "0.2.1", "1.1.0", "0.17.0", + "0.5.0", "0.1.1", "0.1.7", "0.0.1", "0.8.0", "1.0.0", "1.4.1.1", "0.2.6" ), license = c( - "MIT + file LICENSE", "MPL-2.0", "MIT + file LICENSE", - "BSD_3_clause + file LICENSE", "MIT + file LICENSE", "GPL (>= 2)", - "GPL (>= 3)", "GPL (>= 3)", "MIT + file LICENSE", "MIT + file LICENSE", - "GPL (>= 3)", "MIT + file LICENSE", "GPL (>= 3)", "MIT + file LICENSE", - "MIT + file LICENSE", "MIT + file LICENSE", "MIT + file LICENSE", + "MIT + file LICENSE", "MPL-2.0", "MIT + file LICENSE", + "BSD_3_clause + file LICENSE", "MIT + file LICENSE", "GPL (>= 2)", + "GPL (>= 3)", "GPL (>= 3)", "MIT + file LICENSE", "MIT + file LICENSE", + "GPL (>= 3)", "MIT + file LICENSE", "GPL (>= 3)", "MIT + file LICENSE", + "MIT + file LICENSE", "MIT + file LICENSE", "MIT + file LICENSE", "MIT + file LICENSE", "GPL-3", "MIT + file LICENSE" ), remotesha = c( - "9ddc803105f5350dae6efb4ae2657e89d2a54aa8", + "9ddc803105f5350dae6efb4ae2657e89d2a54aa8", "c3de76ddc738dbb4a80ac7ec67ac9da3cba093ba", - "4b5c6a288c0f46a4cdc47f50d2d35395d3e32194", + "4b5c6a288c0f46a4cdc47f50d2d35395d3e32194", "02259ef7aa2a8b1c8de2fa3fc42a9feafd789288", - "498dc55b9ec48c016de9e99ebb4fadf3c0177949", + "498dc55b9ec48c016de9e99ebb4fadf3c0177949", "b0a5ec38638ca69e3adbc7b24d815757e5f74817", - "794e514da2ed6ff94ebe95b970c2434999d632a8", + "794e514da2ed6ff94ebe95b970c2434999d632a8", "049e750168363e80d5d0915d0de9fd515c20f628", - "c73b933868d8c6884df4220c25779cd0874ec7de", + "c73b933868d8c6884df4220c25779cd0874ec7de", "d4740609df6ee38bcf09d1e91691286af23c1b1f", - "54c1637c74e7941fbe9f152df70c0a25f8cd37f6", + "54c1637c74e7941fbe9f152df70c0a25f8cd37f6", "038d5ce10afe592ecc197902f661509481c1d143", - "80cbbd9840091a1e67a99db255cb89b22ee9e0b6", + "80cbbd9840091a1e67a99db255cb89b22ee9e0b6", "bbdda1b4a44a3d6a22041e03eed38f27319d8f32", - "38ce124866879d485f667b7bf3d2a070e6cb37d3", + "38ce124866879d485f667b7bf3d2a070e6cb37d3", "a199a734b16f91726698a19e5f147f57f79cb2b6", - "7e6e3f7ce76abd960c49ef46cc3f4bf1cc8b0637", + "7e6e3f7ce76abd960c49ef46cc3f4bf1cc8b0637", "14f5b87d2dfae20eb35cfd974adf660a4fd89980", - "b2c15f2033a04cd0d5da25aa5ac0c27adc296a47", + "b2c15f2033a04cd0d5da25aa5ac0c27adc296a47", "585458ccbe36eaa179d8b30f04f1e3a91dc6b993" ), needscompilation = c( - "no", - "yes", "yes", "no", "yes", "yes", "yes", "no", "no", "no", "yes", - "yes", "yes", "no", "yes", "no", "no", "no", "no", "yes"), + "no", + "yes", "yes", "no", "yes", "yes", "yes", "no", "no", "no", "yes", + "yes", "yes", "no", "yes", "no", "no", "no", "no", "yes" + ), md5sum = c( - "7e4c4e683057904821a335dc7bc75fd1", - "111a032d82ccf648be06559cd023022d", "20667588d9037d3bc9e632c2d34b56da", - "1d75cc5e11f05fd8a04981c32bce19a1", "c48e76fa587b7783ae154b52d082456c", - "3663b4618478c1298500a11b5e89aea3", "4bbd715cc6cb3a82f7befc929df6d03d", - "cbe8ac6c9e826bc9714d7e7b2d050c13", "1857661573200eba4db7603cbd1d8af3", - "471b6bde16d3edea7019a46326f3987a", "1f8cd6b292ce88e32112f8dc145e9241", - "26a1388aa633d6dd8dd580f6a6947ce7", "d0a8befb8275606f970ad4f42b39578d", - "60f182d9d6cd4dea7e98799ec8b8dea6", "a8f69782953706816a1f6b8d00f9d49e", - "58e478144e6b35029fafb6230755d895", "6410fcc22099bce823b2be379243bb21", - "3f18e78dffa3e45863e95aeb683aa08b", "7e8e297f00058b895d75201f31e65812", + "7e4c4e683057904821a335dc7bc75fd1", + "111a032d82ccf648be06559cd023022d", "20667588d9037d3bc9e632c2d34b56da", + "1d75cc5e11f05fd8a04981c32bce19a1", "c48e76fa587b7783ae154b52d082456c", + "3663b4618478c1298500a11b5e89aea3", "4bbd715cc6cb3a82f7befc929df6d03d", + "cbe8ac6c9e826bc9714d7e7b2d050c13", "1857661573200eba4db7603cbd1d8af3", + "471b6bde16d3edea7019a46326f3987a", "1f8cd6b292ce88e32112f8dc145e9241", + "26a1388aa633d6dd8dd580f6a6947ce7", "d0a8befb8275606f970ad4f42b39578d", + "60f182d9d6cd4dea7e98799ec8b8dea6", "a8f69782953706816a1f6b8d00f9d49e", + "58e478144e6b35029fafb6230755d895", "6410fcc22099bce823b2be379243bb21", + "3f18e78dffa3e45863e95aeb683aa08b", "7e8e297f00058b895d75201f31e65812", "31c8eed8564835a1d83b8115c71dfdf4" ), "_type" = c( - "src", "src", - "src", "src", "src", "src", "src", "src", "src", "src", "src", + "src", "src", + "src", "src", "src", "src", "src", "src", "src", "src", "src", "src", "src", "src", "src", "src", "src", "src", "src", "src" ), "_dependencies" = list( structure( list( package = c( - "R6", "posterior", - "ggplot2", "stats", "stringi", "abind", "future.apply", "dplyr", - "tidyr", "tidyselect", "purrr", "memoise", "testthat", "cmdstanr", - "rstan", "knitr", "rmarkdown", "brms", "MCMCpack", "medicaldata", + "R6", "posterior", + "ggplot2", "stats", "stringi", "abind", "future.apply", "dplyr", + "tidyr", "tidyselect", "purrr", "memoise", "testthat", "cmdstanr", + "rstan", "knitr", "rmarkdown", "brms", "MCMCpack", "medicaldata", "formula.tools", "MASS", "mvtnorm", "patchwork", "bayesplot" - ), - role = c("Imports", "Imports", "Imports", "Imports", "Imports", - "Imports", "Imports", "Imports", - "Imports", "Imports", "Imports", - "Imports", "Suggests", "Suggests", "Suggests", "Suggests", - "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", - "Suggests", "Suggests", "Suggests", "Suggests" - ), - version = c(NA, - ">= 1.0.0", NA, NA, NA, NA, NA, NA, NA, - NA, NA, NA, NA, ">= 0.4.0", - NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA + ), + role = c( + "Imports", "Imports", "Imports", "Imports", "Imports", + "Imports", "Imports", "Imports", + "Imports", "Imports", "Imports", + "Imports", "Suggests", "Suggests", "Suggests", "Suggests", + "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", + "Suggests", "Suggests", "Suggests", "Suggests" + ), + version = c( + NA, + ">= 1.0.0", NA, NA, NA, NA, NA, NA, NA, + NA, NA, NA, NA, ">= 0.4.0", + NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA ) ), class = "data.frame", @@ -219,15 +223,15 @@ mock_meta_packages <- structure( structure( list( package = c( - "R", "Rcpp", "abseil", "Rcpp", + "R", "Rcpp", "abseil", "Rcpp", "utils", "av", "audio" ), version = c( - ">= 2.10", NA, NA, ">= 0.11.5", + ">= 2.10", NA, NA, ">= 0.11.5", NA, NA, NA ), role = c( - "Depends", "LinkingTo", "LinkingTo", "Imports", + "Depends", "LinkingTo", "LinkingTo", "Imports", "Imports", "Suggests", "Suggests" ) ), @@ -237,7 +241,7 @@ mock_meta_packages <- structure( structure( list( package = c( - "R", "Rcpp", "Rcpp", "utils", + "R", "Rcpp", "Rcpp", "utils", "tinytest", "audio", "data.table", "audio.vadwebrtc" ), version = c( @@ -245,7 +249,7 @@ mock_meta_packages <- structure( ), role = c( "Depends", "LinkingTo", "Imports", "Imports", - "Suggests", "Suggests", "Suggests", + "Suggests", "Suggests", "Suggests", "Suggests" ) ), @@ -255,19 +259,19 @@ mock_meta_packages <- structure( structure( list( package = c( - "R", "checkmate", "data.table", "jsonlite", "posterior", - "processx", "R6", "withr", "rlang", "bayesplot", "ggplot2", + "R", "checkmate", "data.table", "jsonlite", "posterior", + "processx", "R6", "withr", "rlang", "bayesplot", "ggplot2", "knitr", "loo", "rmarkdown", "testthat", "Rcpp" ), version = c( ">= 3.5.0", NA, NA, ">= 1.2.0", ">= 1.4.1", - ">= 3.5.0", ">= 2.4.0", ">= 2.5.0", + ">= 3.5.0", ">= 2.4.0", ">= 2.5.0", ">= 0.4.7", NA, NA, ">= 1.37", ">= 2.0.0", NA, ">= 2.1.0", NA ), role = c( - "Depends", "Imports", "Imports", "Imports", - "Imports", "Imports", "Imports", "Imports", "Imports", "Suggests", - "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", + "Depends", "Imports", "Imports", "Imports", + "Imports", "Imports", "Imports", "Imports", "Imports", "Suggests", + "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", "Suggests" ) ), @@ -277,21 +281,21 @@ mock_meta_packages <- structure( structure( list( package = c( - "DBI", "R", "methods", "utils", + "DBI", "R", "methods", "utils", "adbcdrivermanager", "arrow", "bit64", - "callr", "DBItest", "dbplyr", + "callr", "DBItest", "dbplyr", "dplyr", "rlang", "testthat", "tibble", "vctrs", "withr" ), role = c( "Depends", "Depends", "Imports", "Imports", - "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", - "Suggests", "Suggests", "Suggests", + "Suggests", "Suggests", "Suggests", + "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", "Suggests" ), version = c( NA, ">= 3.6.0", NA, NA, NA, ">= 13.0.0", - NA, NA, NA, NA, NA, NA, NA, NA, NA, + NA, NA, NA, NA, NA, NA, NA, NA, NA, NA ) ), @@ -301,17 +305,17 @@ mock_meta_packages <- structure( structure( list( package = c( - "R", "unigd", "cpp11", "AsioHeaders", "unigd", - "testthat", "xml2", "knitr", "rmarkdown", "covr", "future", + "R", "unigd", "cpp11", "AsioHeaders", "unigd", + "testthat", "xml2", "knitr", "rmarkdown", "covr", "future", "httr", "jsonlite" ), version = c( - ">= 3.2.0", NA, ">= 0.2.4", + ">= 3.2.0", NA, ">= 0.2.4", ">= 1.22.1", NA, NA, ">= 1.0.0", NA, NA, NA, NA, NA, NA - ), + ), role = c( - "Depends", "LinkingTo", "LinkingTo", "LinkingTo", - "Imports", "Suggests", "Suggests", "Suggests", "Suggests", + "Depends", "LinkingTo", "LinkingTo", "LinkingTo", + "Imports", "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", "Suggests" ) ), @@ -322,21 +326,22 @@ mock_meta_packages <- structure( list( package = c( "R", "RcppSimdJson", "xts", "ggplot2", - "mirai", "nanonext", "RcppSimdJson", "secretbase", + "mirai", "nanonext", "RcppSimdJson", "secretbase", "shiny", "xts", "zoo", "keyring", "knitr", "rmarkdown", "testthat" ), version = c( - ">= 3.5", NA, NA, ">= 3.4.0", ">= 1.0.0", ">= 1.0.0", + ">= 3.5", NA, NA, ">= 3.4.0", ">= 1.0.0", ">= 1.0.0", ">= 0.1.9", ">= 0.3.0", ">= 1.4.0", NA, NA, NA, NA, NA, ">= 3.0.0" ), role = c( - "Depends", "LinkingTo", "LinkingTo", "Imports", "Imports", - "Imports", "Imports", "Imports", "Imports", "Imports", "Imports", + "Depends", "LinkingTo", "LinkingTo", "Imports", "Imports", + "Imports", "Imports", "Imports", "Imports", "Imports", "Imports", "Suggests", "Suggests", "Suggests", "Suggests" ) ), class = "data.frame", - row.names = c(NA, 15L)), + row.names = c(NA, 15L) + ), structure( list( package = c( @@ -344,7 +349,7 @@ mock_meta_packages <- structure( ), version = c(">= 3.6", ">= 1.1.0", NA, NA, NA, NA), role = c( - "Depends", "Imports", "Suggests", "Suggests", + "Depends", "Imports", "Suggests", "Suggests", "Enhances", "Enhances" ) ), @@ -353,17 +358,17 @@ mock_meta_packages <- structure( structure( list( package = c( - "R", "jsonlite", "tibble", "curl", + "R", "jsonlite", "tibble", "curl", "knitr", "markdown", "rmarkdown", "testthat" ), version = c( - ">= 4.0.0", + ">= 4.0.0", NA, NA, NA, ">= 1.30", ">= 1.1", ">= 2.4", ">= 3.0.0" ), role = c( - "Depends", + "Depends", "Imports", "Imports", "Suggests", - "Suggests", "Suggests", "Suggests", + "Suggests", "Suggests", "Suggests", "Suggests" ) ), @@ -373,15 +378,15 @@ mock_meta_packages <- structure( structure( list( package = c( - "R", "gh", "jsonlite", "nanonext", "pkgsearch", + "R", "gh", "jsonlite", "nanonext", "pkgsearch", "utils", "vctrs", "testthat" ), version = c( - ">= 3.5.0", NA, + ">= 3.5.0", NA, NA, NA, NA, NA, NA, ">= 3.0.0" ), role = c( - "Depends", "Imports", + "Depends", "Imports", "Imports", "Imports", "Imports", "Imports", "Imports", "Suggests" ) ), @@ -390,10 +395,10 @@ mock_meta_packages <- structure( ), structure( list( - package = c("R", "later", "later", "knitr", "markdown"), + package = c("R", "later", "later", "knitr", "markdown"), version = c(">= 3.5", NA, NA, NA, NA), role = c( - "Depends", + "Depends", "LinkingTo", "Imports", "Suggests", "Suggests" ) ), @@ -403,26 +408,26 @@ mock_meta_packages <- structure( structure( list( package = c( - "R", "utils", "codetools", "methods", - "arrow", "bench", "bit64", "callr", "clock", "curl", "ggplot2", - "jsonlite", "knitr", "lubridate", "nanoarrow", "nycflights13", - "patrick", "pillar", "rlang", "rmarkdown", "testthat", "tibble", + "R", "utils", "codetools", "methods", + "arrow", "bench", "bit64", "callr", "clock", "curl", "ggplot2", + "jsonlite", "knitr", "lubridate", "nanoarrow", "nycflights13", + "patrick", "pillar", "rlang", "rmarkdown", "testthat", "tibble", "tools", "vctrs", "withr" ), version = c( - ">= 4.2", NA, NA, NA, + ">= 4.2", NA, NA, NA, ">= 15.0.1", NA, NA, NA, ">= 0.7.0", - NA, NA, NA, NA, NA, ">= 0.4.0", + NA, NA, NA, NA, NA, ">= 0.4.0", NA, NA, NA, NA, NA, ">= 3.2.1", NA, NA, NA, NA ), role = c( - "Depends", + "Depends", "Imports", "Imports", "Imports", "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", - "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", - "Suggests", "Suggests", "Suggests", + "Suggests", "Suggests", "Suggests", + "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", "Suggests" ) @@ -438,29 +443,29 @@ mock_meta_packages <- structure( ), class = "data.frame", row.names = 1L - ), + ), structure( list( package = c( - "R", "cmdstanr", "fs", "fst", - "posterior", "purrr", "qs", "rlang", "secretbase", "stats", - "targets", "tarchetypes", "tibble", "tidyselect", "withr", - "dplyr", "ggplot2", "knitr", "R.utils", "rmarkdown", "SBC", + "R", "cmdstanr", "fs", "fst", + "posterior", "purrr", "qs", "rlang", "secretbase", "stats", + "targets", "tarchetypes", "tibble", "tidyselect", "withr", + "dplyr", "ggplot2", "knitr", "R.utils", "rmarkdown", "SBC", "testthat", "tidyr", "visNetwork" ), version = c( - ">= 3.5.0", - ">= 0.5.0", ">= 1.5.0", ">= 0.9.2", ">= 1.0.1", ">= 0.3.4", - ">= 0.23.2", ">= 0.4.10", ">= 0.4.0", NA, ">= 1.6.0", ">= 0.8.0", - ">= 3.0.1", NA, ">= 2.1.2", ">= 1.0.2", ">= 3.0.0", ">= 1.30", - ">= 2.10.1", ">= 2.3", ">= 0.2.0", ">= 3.0.0", ">= 1.0.0", + ">= 3.5.0", + ">= 0.5.0", ">= 1.5.0", ">= 0.9.2", ">= 1.0.1", ">= 0.3.4", + ">= 0.23.2", ">= 0.4.10", ">= 0.4.0", NA, ">= 1.6.0", ">= 0.8.0", + ">= 3.0.1", NA, ">= 2.1.2", ">= 1.0.2", ">= 3.0.0", ">= 1.30", + ">= 2.10.1", ">= 2.3", ">= 0.2.0", ">= 3.0.0", ">= 1.0.0", ">= 2.0.9" ), role = c( - "Depends", "Imports", "Imports", "Imports", - "Imports", "Imports", "Imports", "Imports", "Imports", "Imports", - "Imports", "Imports", "Imports", "Imports", "Imports", "Suggests", - "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", + "Depends", "Imports", "Imports", "Imports", + "Imports", "Imports", "Imports", "Imports", "Imports", "Imports", + "Imports", "Imports", "Imports", "Imports", "Imports", "Suggests", + "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", "Suggests" ) ), @@ -479,21 +484,21 @@ mock_meta_packages <- structure( structure( list( package = c( - "R", "bs4Dash", "DT", "htmltools", - "markdown", "rclipboard", "shiny", "shinyalert", "shinyAce", - "shinybusy", "shinycssloaders", "shinyFiles", "targets", + "R", "bs4Dash", "DT", "htmltools", + "markdown", "rclipboard", "shiny", "shinyalert", "shinyAce", + "shinybusy", "shinycssloaders", "shinyFiles", "targets", "tarchetypes", "visNetwork", "withr", "pkgload", "rmarkdown" ), version = c( - ">= 4.1.0", ">= 2.0.0", ">= 0.14", ">= 0.5.0", - NA, NA, ">= 1.5.0", ">= 1.1", ">= 0.4.1", ">= 0.2.0", ">= 0.3", - ">= 0.9.3", ">= 0.2.0", ">= 0.1.0", ">= 2.0.9", ">= 2.2.0", + ">= 4.1.0", ">= 2.0.0", ">= 0.14", ">= 0.5.0", + NA, NA, ">= 1.5.0", ">= 1.1", ">= 0.4.1", ">= 0.2.0", ">= 0.3", + ">= 0.9.3", ">= 0.2.0", ">= 0.1.0", ">= 2.0.9", ">= 2.2.0", ">= 1.1.0", ">= 2.3" ), role = c( - "Depends", "Imports", "Imports", - "Imports", "Imports", "Imports", "Imports", "Imports", "Imports", - "Imports", "Imports", "Imports", "Imports", "Imports", "Imports", + "Depends", "Imports", "Imports", + "Imports", "Imports", "Imports", "Imports", "Imports", "Imports", + "Imports", "Imports", "Imports", "Imports", "Imports", "Imports", "Imports", "Suggests", "Suggests" ) ), @@ -503,19 +508,19 @@ mock_meta_packages <- structure( structure( list( package = c( - "R", "dplyr", "glue", "polars", - "rlang", "tidyr", "tidyselect", "utils", "vctrs", "bench", - "data.table", "knitr", "lubridate", "rmarkdown", "rstudioapi", + "R", "dplyr", "glue", "polars", + "rlang", "tidyr", "tidyselect", "utils", "vctrs", "bench", + "data.table", "knitr", "lubridate", "rmarkdown", "rstudioapi", "tibble", "tinytest" ), version = c( - ">= 4.1.0", NA, NA, ">= 0.17.0", + ">= 4.1.0", NA, NA, ">= 0.17.0", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA ), role = c( - "Depends", - "Imports", "Imports", "Imports", "Imports", "Imports", "Imports", - "Imports", "Imports", "Suggests", "Suggests", "Suggests", + "Depends", + "Imports", "Imports", "Imports", "Imports", "Imports", "Imports", + "Imports", "Imports", "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", "Suggests" ) ), @@ -525,15 +530,15 @@ mock_meta_packages <- structure( structure( list( package = c( - "abind", "purrr", "rstackdeque", "magrittr", - "rlang", "tidyselect", "testthat", "reticulate", "stringr", - "keras", "dplyr", "covr", "knitr", "markdown", "ggplot2", + "abind", "purrr", "rstackdeque", "magrittr", + "rlang", "tidyselect", "testthat", "reticulate", "stringr", + "keras", "dplyr", "covr", "knitr", "markdown", "ggplot2", "tidyr" ), role = c( - "Imports", "Imports", "Imports", "Imports", - "Imports", "Imports", "Suggests", "Suggests", "Suggests", - "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", + "Imports", "Imports", "Imports", "Imports", + "Imports", "Imports", "Suggests", "Suggests", "Suggests", + "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", "Suggests", "Suggests" ) ), @@ -545,22 +550,22 @@ mock_meta_packages <- structure( package = c("R", "parallel", "utils"), version = c(">= 3.0.0", NA, NA), role = c( - "Depends", "Imports", + "Depends", "Imports", "Imports" ) ), class = "data.frame", row.names = c(NA, 3L) - ), + ), structure( list( package = c( - "R", "knitr", "rmarkdown", "testthat", + "R", "knitr", "rmarkdown", "testthat", "bench" ), version = c(">= 3.4.0", NA, NA, NA, NA), role = c( - "Depends", + "Depends", "Suggests", "Suggests", "Suggests", "Suggests" ) ), @@ -569,15 +574,15 @@ mock_meta_packages <- structure( ) ), distro = c( - "noble", "noble", "noble", "noble", "noble", - "noble", "noble", "noble", "noble", "noble", "noble", "noble", - "noble", "noble", "noble", "noble", "noble", "noble", "noble", + "noble", "noble", "noble", "noble", "noble", + "noble", "noble", "noble", "noble", "noble", "noble", "noble", + "noble", "noble", "noble", "noble", "noble", "noble", "noble", "noble" ), remotes = list( - NULL, NULL, "bnosac/audio.vadwebrtc", - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - c("hyunjimoon/SBC", "stan-dev/cmdstanr", ""), NULL, NULL, + NULL, NULL, "bnosac/audio.vadwebrtc", + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + c("hyunjimoon/SBC", "stan-dev/cmdstanr", ""), NULL, NULL, "markvanderloo/tinytest/pkg", NULL, NULL, NULL ) ), From 6bd6cf94fd2019fdcc6bb05371eaa0e47d9d9c69 Mon Sep 17 00:00:00 2001 From: wlandau Date: Mon, 10 Jun 2024 14:52:09 -0400 Subject: [PATCH 08/17] fix a test --- tests/testthat/test-issues_checks.R | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/tests/testthat/test-issues_checks.R b/tests/testthat/test-issues_checks.R index 5babb1e..f3c256c 100644 --- a/tests/testthat/test-issues_checks.R +++ b/tests/testthat/test-issues_checks.R @@ -5,41 +5,36 @@ test_that("issues_checks() mocked", { httpgd = list( "_linuxdevel" = "success", "_macbinary" = "success", "_wasmbinary" = "none", "_winbinary" = "success", "_status" = "success", - "_buildurl" = file.path(url, "8998732459") + "_buildurl" = file.path(url, "9403635056") ), INLA = list( "_linuxdevel" = "src-failure", "_macbinary" = "src-failure", "_wasmbinary" = "src-failure", "_winbinary" = "src-failure", "_status" = "src-failure", - "_buildurl" = file.path(url, "8487512222") + "_buildurl" = file.path(url, "9296256187") ), polars = list( "_linuxdevel" = "failure", "_macbinary" = "arm64-failure", "_wasmbinary" = "none", "_winbinary" = "success", "_status" = "success", - "_buildurl" = file.path(url, "9005231218") + "_buildurl" = file.path(url, "9360739181") ), SBC = list( "_linuxdevel" = "failure", "_macbinary" = "success", "_wasmbinary" = "success", "_winbinary" = "success", "_status" = "failure", - "_buildurl" = file.path(url, "8998731731") + "_buildurl" = file.path(url, "9412009979") ), stantargets = list( "_linuxdevel" = "failure", "_macbinary" = "success", "_wasmbinary" = "success", "_winbinary" = "success", "_status" = "success", - "_buildurl" = file.path(url, "8998732490") - ), - string2path = list( - "_linuxdevel" = "success", "_macbinary" = "success", - "_wasmbinary" = "none", "_winbinary" = "success", "_status" = "success", - "_buildurl" = file.path(url, "8998732437") + "_buildurl" = file.path(url, "9412009826") ), tidytensor = list( "_linuxdevel" = "failure", "_macbinary" = "success", "_wasmbinary" = "success", "_winbinary" = "success", "_status" = "failure", - "_buildurl" = file.path(url, "8998732025") + "_buildurl" = file.path(url, "9412009544") ) ) expect_equal(issues[order(names(issues))], expected[order(names(expected))]) From d9badabeca71d02a171213e53df290878128fbc6 Mon Sep 17 00:00:00 2001 From: wlandau Date: Mon, 10 Jun 2024 14:59:30 -0400 Subject: [PATCH 09/17] Update testing --- tests/testthat/test-record_issues.R | 44 ++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/tests/testthat/test-record_issues.R b/tests/testthat/test-record_issues.R index 6688158..205d9cd 100644 --- a/tests/testthat/test-record_issues.R +++ b/tests/testthat/test-record_issues.R @@ -19,7 +19,6 @@ test_that("record_issues() mocked", { "polars", "SBC", "stantargets", - "string2path", "tidypolars", "tidytensor", "version_decremented", @@ -37,9 +36,11 @@ test_that("record_issues() mocked", { "_wasmbinary" = "src-failure", "_winbinary" = "src-failure", "_status" = "src-failure", - "_buildurl" = file.path(runs, "8487512222") + "_buildurl" = file.path(runs, "9296256187") ), - date = "2024-01-01" + date = "2024-01-01", + version = list(), + remote_hash = list() ) ) expect_equal( @@ -54,12 +55,14 @@ test_that("record_issues() mocked", { "_wasmbinary" = "success", "_winbinary" = "success", "_status" = "success", - "_buildurl" = file.path(runs, "8998732490") + "_buildurl" = file.path(runs, "9412009826") ), descriptions = list( remotes = c("hyunjimoon/SBC", "stan-dev/cmdstanr") ), - date = "2024-01-01" + date = "2024-01-01", + version = "0.1.1", + remote_hash = "bbdda1b4a44a3d6a22041e03eed38f27319d8f32" ) ) expect_equal( @@ -74,7 +77,9 @@ test_that("record_issues() mocked", { version_highest = "1.0.0", hash_highest = "hash_1.0.0" ), - date = "2024-01-01" + date = "2024-01-01", + version = list(), + remote_hash = list() ) ) expect_equal( @@ -89,7 +94,9 @@ test_that("record_issues() mocked", { version_highest = "1.0.0", hash_highest = "hash_1.0.0" ), - date = "2024-01-01" + date = "2024-01-01", + version = list(), + remote_hash = list() ) ) }) @@ -121,7 +128,6 @@ test_that("record_issues() date works", { "httpgd", "INLA", "stantargets", - "string2path", "tidytensor", "version_decremented" ) @@ -209,7 +215,9 @@ test_that("record_issues() with dependency problems", { version_highest = "1.0.0", hash_highest = "hash_1.0.0" ), - date = "2024-01-01" + date = "2024-01-01", + version = "1.1.0.9000", + remote_hash = "85dd672a44a92c890eb40ea9ebab7a4e95335c2f" ) ) expect_equal( @@ -221,7 +229,9 @@ test_that("record_issues() with dependency problems", { dependencies = list( nanonext = list() ), - date = "2024-01-01" + date = "2024-01-01", + version = "1.1.0.9000", + remote_hash = "7015695b7ef82f82ab3225ac2d226b2c8f298097" ) ) expect_equal( @@ -238,13 +248,15 @@ test_that("record_issues() with dependency problems", { "_status" = "success", "_buildurl" = file.path( "https://github.com/r-universe/r-multiverse/actions", - "runs/8998731783" + "runs/9412009683" ) ), dependencies = list( nanonext = "mirai" ), - date = "2024-01-01" + date = "2024-01-01", + version = "0.9.3.9002", + remote_hash = "eafad0276c06dec2344da2f03596178c754c8b5e" ) ) expect_equal( @@ -257,7 +269,9 @@ test_that("record_issues() with dependency problems", { crew = list(), nanonext = "crew" ), - date = "2024-01-01" + date = "2024-01-01", + version = "0.0.5.9000", + remote_hash = "4d9e5b44e2942d119af963339c48d134e84de458" ) ) expect_equal( @@ -270,7 +284,9 @@ test_that("record_issues() with dependency problems", { crew = list(), nanonext = "crew" ), - date = "2024-01-01" + date = "2024-01-01", + version = "0.3.1", + remote_hash = "d4ac61fd9a1d9539088ffebdadcd4bb713c25ee1" ) ) }) From 6931801d7b8f6b736cc1310718c196ee04ed85cc Mon Sep 17 00:00:00 2001 From: wlandau Date: Mon, 10 Jun 2024 16:11:46 -0400 Subject: [PATCH 10/17] Fix pkgdown --- _pkgdown.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/_pkgdown.yml b/_pkgdown.yml index e5e165f..bb70c02 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -16,6 +16,7 @@ reference: - title: Check issues contents: - issues_checks + - issues_dependencies - issues_descriptions - issues_versions - title: Record issues From 15755bc848b52ca5667b6bb50c39f34c704f648e Mon Sep 17 00:00:00 2001 From: wlandau Date: Mon, 10 Jun 2024 16:17:18 -0400 Subject: [PATCH 11/17] version and news --- DESCRIPTION | 2 +- NEWS.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 4b4cb32..d32caf2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: multiverse.internals Title: Internal Infrastructure for R-multiverse Description: R-multiverse requires this internal internal infrastructure package to automate contribution reviews and populate universes. -Version: 0.2.1 +Version: 0.2.2 License: MIT + file LICENSE URL: https://github.com/r-multiverse/multiverse.internals BugReports: https://github.com/r-multiverse/multiverse.internals/issues diff --git a/NEWS.md b/NEWS.md index d07950a..e00394b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# multiverse.internals 0.2.2 + +* Add `issues_dependencies()`. + # multiverse.internals 0.2.1 * Bump version to trigger rebuild. From 5e295ac3c54107ea063e8d6efb981fe9bfeb4831 Mon Sep 17 00:00:00 2001 From: wlandau Date: Mon, 10 Jun 2024 16:45:48 -0400 Subject: [PATCH 12/17] default meta args --- R/issues_checks.R | 2 +- R/issues_dependencies.R | 5 ++++- R/issues_descriptions.R | 4 +++- man/issues_checks.Rd | 2 +- man/issues_dependencies.Rd | 2 +- man/issues_descriptions.Rd | 2 +- 6 files changed, 11 insertions(+), 6 deletions(-) diff --git a/R/issues_checks.R b/R/issues_checks.R index d753a3f..4c31e16 100644 --- a/R/issues_checks.R +++ b/R/issues_checks.R @@ -17,7 +17,7 @@ #' meta <- meta_checks(repo = "https://wlandau.r-universe.dev") #' issues <- issues_checks(meta = meta) #' str(issues) -issues_checks <- function(meta) { +issues_checks <- function(meta = multiverse.internals::meta_checks()) { fields_check <- c( "_linuxdevel", "_macbinary", diff --git a/R/issues_dependencies.R b/R/issues_dependencies.R index bd06f91..c2a270d 100644 --- a/R/issues_dependencies.R +++ b/R/issues_dependencies.R @@ -36,7 +36,10 @@ #' issues_dependencies(packages = "nanonext", meta = meta) #' issues_dependencies(packages = "crew", meta = meta) #' issues_dependencies(packages = c("crew", "mirai"), meta = meta) -issues_dependencies <- function(packages, meta) { +issues_dependencies <- function( + packages, + meta = multiverse.internals::meta_packages() +) { graph <- issues_dependencies_graph(meta) vertices <- names(igraph::V(graph)) issues <- list() diff --git a/R/issues_descriptions.R b/R/issues_descriptions.R index 950bf91..91e5a67 100644 --- a/R/issues_descriptions.R +++ b/R/issues_descriptions.R @@ -17,7 +17,9 @@ #' meta <- meta_packages(repo = "https://wlandau.r-universe.dev") #' issues <- issues_descriptions(meta = meta) #' str(issues) -issues_descriptions <- function(meta) { +issues_descriptions <- function( + meta = multiverse.internals::meta_packages() +) { meta <- issues_descriptions_remotes(meta) fields <- "remotes" meta <- meta[, c("package", fields)] diff --git a/man/issues_checks.Rd b/man/issues_checks.Rd index a254b3a..174c358 100644 --- a/man/issues_checks.Rd +++ b/man/issues_checks.Rd @@ -4,7 +4,7 @@ \alias{issues_checks} \title{Report issues from R-universe package check results.} \usage{ -issues_checks(meta) +issues_checks(meta = multiverse.internals::meta_checks()) } \arguments{ \item{meta}{A data frame with R-universe package check results diff --git a/man/issues_dependencies.Rd b/man/issues_dependencies.Rd index 8af4da9..6f6c299 100644 --- a/man/issues_dependencies.Rd +++ b/man/issues_dependencies.Rd @@ -4,7 +4,7 @@ \alias{issues_dependencies} \title{Report package dependency issues} \usage{ -issues_dependencies(packages, meta) +issues_dependencies(packages, meta = multiverse.internals::meta_packages()) } \arguments{ \item{packages}{Character vector of names of packages with other issues.} diff --git a/man/issues_descriptions.Rd b/man/issues_descriptions.Rd index 3edbf10..4c02658 100644 --- a/man/issues_descriptions.Rd +++ b/man/issues_descriptions.Rd @@ -4,7 +4,7 @@ \alias{issues_descriptions} \title{Report \code{DESCRIPTION} file issues.} \usage{ -issues_descriptions(meta) +issues_descriptions(meta = multiverse.internals::meta_packages()) } \arguments{ \item{meta}{A data frame with R-universe package check results From f0998c3b8233e6a1acab7accca5f2320c2c70d68 Mon Sep 17 00:00:00 2001 From: wlandau Date: Tue, 11 Jun 2024 09:08:57 -0400 Subject: [PATCH 13/17] try to speed up dependency graph construction --- R/issues_dependencies.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/issues_dependencies.R b/R/issues_dependencies.R index c2a270d..fa60de6 100644 --- a/R/issues_dependencies.R +++ b/R/issues_dependencies.R @@ -64,7 +64,8 @@ issues_dependencies_graph <- function(meta) { packages <- .subset2(all, "package") role <- .subset2(all, "role") strong <- packages[role %in% c("Depends", "Imports", "LinkingTo")] - strong <- intersect(setdiff(unique(strong), "R"), repo_packages) + strong <- setdiff(unique(strong), "R") + strong <- strong[match(strong, repo_packages, nomatch = 0L) > 0L] edges <- rep(strong, each = 2L) if (length(edges) >= 2L) { edges[seq(from = 2L, to = length(edges), by = 2L)] <- package From f9d7ea356b539f855b74fc8681fe6dc258552b05 Mon Sep 17 00:00:00 2001 From: wlandau Date: Tue, 11 Jun 2024 09:37:50 -0400 Subject: [PATCH 14/17] speed up issues_dependencies() --- R/issues_dependencies.R | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/R/issues_dependencies.R b/R/issues_dependencies.R index fa60de6..f170ef0 100644 --- a/R/issues_dependencies.R +++ b/R/issues_dependencies.R @@ -42,13 +42,21 @@ issues_dependencies <- function( ) { graph <- issues_dependencies_graph(meta) vertices <- names(igraph::V(graph)) + edges <- igraph::as_long_data_frame(graph) + from <- tapply( + X = edges$from_name, + INDEX = edges$to_name, + FUN = identity, + simplify = FALSE + ) issues <- list() for (package in intersect(packages, vertices)) { revdeps <- names(igraph::subcomponent(graph, v = package, mode = "out")) revdeps <- setdiff(revdeps, package) for (revdep in revdeps) { - neighbors <- names(igraph::neighbors(graph, v = revdep, mode = "in")) - issues[[revdep]][[package]] <- intersect(neighbors, revdeps) + neighbors <- from[[revdep]] + keep <- match(neighbors, revdeps, nomatch = 0L) > 0L + issues[[revdep]][[package]] <- neighbors[keep] } } issues @@ -57,7 +65,8 @@ issues_dependencies <- function( issues_dependencies_graph <- function(meta) { repo_packages <- meta$package repo_dependencies <- meta[["_dependencies"]] - edge_list <- list() + from <- list() + to <- list() for (index in seq_len(nrow(meta))) { package <- .subset2(repo_packages, index) all <- .subset2(repo_dependencies, index) @@ -65,12 +74,14 @@ issues_dependencies_graph <- function(meta) { role <- .subset2(all, "role") strong <- packages[role %in% c("Depends", "Imports", "LinkingTo")] strong <- setdiff(unique(strong), "R") - strong <- strong[match(strong, repo_packages, nomatch = 0L) > 0L] - edges <- rep(strong, each = 2L) - if (length(edges) >= 2L) { - edges[seq(from = 2L, to = length(edges), by = 2L)] <- package - edge_list[[index]] <- edges - } + from[[index]] <- strong + to[[index]] <- rep(package, length(strong)) } - igraph::graph(edges = unlist(edge_list)) + from <- unlist(from, recursive = FALSE, use.names = FALSE) + to <- unlist(to, recursive = FALSE, use.names = FALSE) + keep <- match(from, repo_packages, nomatch = 0L) > 0L + from <- from[keep] + to <- to[keep] + edges <- as.character(rbind(from, to)) + igraph::graph(edges = edges) } From 230a3cb6988f3c0bb24f489aca18b2a48b7003a5 Mon Sep 17 00:00:00 2001 From: wlandau Date: Tue, 11 Jun 2024 09:48:14 -0400 Subject: [PATCH 15/17] Verbosity in issues_dependencies() --- R/issues_dependencies.R | 7 ++++- R/record_issues.R | 9 ++++-- man/issues_dependencies.Rd | 9 +++++- man/record_issues.Rd | 6 +++- tests/testthat/test-issues_dependencies.R | 34 +++++++++++++++-------- tests/testthat/test-record_issues.R | 34 ++++++++++++++--------- 6 files changed, 70 insertions(+), 29 deletions(-) diff --git a/R/issues_dependencies.R b/R/issues_dependencies.R index f170ef0..a7ffdbb 100644 --- a/R/issues_dependencies.R +++ b/R/issues_dependencies.R @@ -29,6 +29,8 @@ #' @param packages Character vector of names of packages with other issues. #' @param meta A data frame with R-universe package check results #' returned by [meta_checks()]. +#' @param verbose `TRUE` to print progress while checking issues with +#' dependencies, `FALSE` otherwise. #' @examples #' meta <- meta_packages(repo = "https://wlandau.r-universe.dev") #' issues_dependencies(packages = character(0L), meta = meta) @@ -38,8 +40,10 @@ #' issues_dependencies(packages = c("crew", "mirai"), meta = meta) issues_dependencies <- function( packages, - meta = multiverse.internals::meta_packages() + meta = multiverse.internals::meta_packages(), + verbose = TRUE ) { + if (verbose) message("Constructing the package dependency graph") graph <- issues_dependencies_graph(meta) vertices <- names(igraph::V(graph)) edges <- igraph::as_long_data_frame(graph) @@ -51,6 +55,7 @@ issues_dependencies <- function( ) issues <- list() for (package in intersect(packages, vertices)) { + if (verbose) message("Flagging reverse dependencies of ", package) revdeps <- names(igraph::subcomponent(graph, v = package, mode = "out")) revdeps <- setdiff(revdeps, package) for (revdep in revdeps) { diff --git a/R/record_issues.R b/R/record_issues.R index d8b651d..b49a58c 100644 --- a/R/record_issues.R +++ b/R/record_issues.R @@ -25,6 +25,7 @@ #' all package are resolved. #' @return `NULL` (invisibly). #' @inheritParams issues_checks +#' @inheritParams issues_dependencies #' @inheritParams issues_versions #' @inheritParams meta_checks #' @param output Character of length 1, file path to the folder to record @@ -58,7 +59,8 @@ record_issues <- function( repo = "https://multiverse.r-multiverse.org", versions = "versions.json", output = "issues", - mock = NULL + mock = NULL, + verbose = TRUE ) { today <- mock$today %||% format(Sys.Date(), fmt = "yyyy-mm-dd") checks <- mock$checks %||% meta_checks(repo = repo) @@ -68,7 +70,10 @@ record_issues <- function( add_issues(issues_descriptions(meta = packages), "descriptions") |> add_issues(issues_versions(versions = versions), "versions") issues <- issues |> - add_issues(issues_dependencies(names(issues), packages), "dependencies") + add_issues( + issues_dependencies(names(issues), packages, verbose = verbose), + "dependencies" + ) overwrite_issues( issues = issues, output = output, diff --git a/man/issues_dependencies.Rd b/man/issues_dependencies.Rd index 6f6c299..6b6dfc2 100644 --- a/man/issues_dependencies.Rd +++ b/man/issues_dependencies.Rd @@ -4,13 +4,20 @@ \alias{issues_dependencies} \title{Report package dependency issues} \usage{ -issues_dependencies(packages, meta = multiverse.internals::meta_packages()) +issues_dependencies( + packages, + meta = multiverse.internals::meta_packages(), + verbose = TRUE +) } \arguments{ \item{packages}{Character vector of names of packages with other issues.} \item{meta}{A data frame with R-universe package check results returned by \code{\link[=meta_checks]{meta_checks()}}.} + +\item{verbose}{\code{TRUE} to print progress while checking issues with +dependencies, \code{FALSE} otherwise.} } \value{ A nested list of problems triggered by dependencies. diff --git a/man/record_issues.Rd b/man/record_issues.Rd index 31d3d97..bbd0df2 100644 --- a/man/record_issues.Rd +++ b/man/record_issues.Rd @@ -8,7 +8,8 @@ record_issues( repo = "https://multiverse.r-multiverse.org", versions = "versions.json", output = "issues", - mock = NULL + mock = NULL, + verbose = TRUE ) } \arguments{ @@ -27,6 +28,9 @@ contents of the repo.} \item{mock}{For testing purposes only, a named list of data frames for inputs to various intermediate functions.} + +\item{verbose}{\code{TRUE} to print progress while checking issues with +dependencies, \code{FALSE} otherwise.} } \value{ \code{NULL} (invisibly). diff --git a/tests/testthat/test-issues_dependencies.R b/tests/testthat/test-issues_dependencies.R index c39467a..06525bd 100644 --- a/tests/testthat/test-issues_dependencies.R +++ b/tests/testthat/test-issues_dependencies.R @@ -15,7 +15,8 @@ test_that("issues_dependencies() no issues", { expect_equal( issues_dependencies( packages = character(0L), - meta = mock_meta_packages_graph + meta = mock_meta_packages_graph, + verbose = FALSE ), list() ) @@ -25,7 +26,8 @@ test_that("issues_dependencies() no revdeps", { expect_equal( issues_dependencies( packages = "crew.aws.batch", - meta = mock_meta_packages_graph + meta = mock_meta_packages_graph, + verbose = FALSE ), list() ) @@ -33,9 +35,11 @@ test_that("issues_dependencies() no revdeps", { test_that("issues_dependencies() nanonext", { expect_equal( - issues_dependencies( - packages = "nanonext", - meta = mock_meta_packages_graph + suppressMessages( + issues_dependencies( + packages = "nanonext", + meta = mock_meta_packages_graph + ) ), list( mirai = list(nanonext = character(0L)), @@ -50,7 +54,8 @@ test_that("issues_dependencies() mirai", { expect_equal( issues_dependencies( packages = "mirai", - meta = mock_meta_packages_graph + meta = mock_meta_packages_graph, + verbose = FALSE ), list( crew = list(mirai = character(0L)), @@ -64,7 +69,8 @@ test_that("issues_dependencies() crew", { expect_equal( issues_dependencies( packages = "crew", - meta = mock_meta_packages_graph + meta = mock_meta_packages_graph, + verbose = FALSE ), list( crew.aws.batch = list(crew = character(0L)), @@ -77,7 +83,8 @@ test_that("issues_dependencies() nanonext and mirai", { expect_equal( issues_dependencies( packages = c("nanonext", "mirai"), - meta = mock_meta_packages_graph + meta = mock_meta_packages_graph, + verbose = FALSE ), list( mirai = list(nanonext = character(0L)), @@ -92,7 +99,8 @@ test_that("issues_dependencies() nanonext and mirai", { expect_equal( issues_dependencies( packages = c("crew", "mirai"), - meta = mock_meta_packages_graph + meta = mock_meta_packages_graph, + verbose = FALSE ), list( crew.aws.batch = list(crew = character(0L), mirai = "crew"), @@ -112,7 +120,7 @@ test_that("issues_dependencies() with more than one direct dependency", { data.frame(package = "x", version = NA_character_, role = "Imports") ) expect_equal( - issues_dependencies(packages = "mirai", meta = meta), + issues_dependencies(packages = "mirai", meta = meta, verbose = FALSE), list( crew = list(mirai = character(0L)), x = list(mirai = character(0L)), @@ -132,7 +140,11 @@ test_that("issues_dependencies() with more than one direct dependency (2)", { data.frame(package = "x", version = NA_character_, role = "Imports") ) expect_equal( - issues_dependencies(packages = c("mirai", "nanonext"), meta = meta), + issues_dependencies( + packages = c("mirai", "nanonext"), + meta = meta, + verbose = FALSE + ), list( crew = list(mirai = character(0L), nanonext = "mirai"), x = list(mirai = character(0L), nanonext = "mirai"), diff --git a/tests/testthat/test-record_issues.R b/tests/testthat/test-record_issues.R index 205d9cd..706643b 100644 --- a/tests/testthat/test-record_issues.R +++ b/tests/testthat/test-record_issues.R @@ -7,7 +7,8 @@ test_that("record_issues() mocked", { packages = mock_meta_packages, today = "2024-01-01" ), - output = output + output = output, + verbose = FALSE ) expect_equal( sort(c(list.files(output))), @@ -110,7 +111,8 @@ test_that("record_issues() date works", { packages = mock_meta_packages, today = "2024-01-01" ), - output = output + output = output, + verbose = FALSE ) record_issues( versions = mock_versions(), @@ -118,7 +120,8 @@ test_that("record_issues() date works", { checks = mock_meta_checks, packages = mock_meta_packages ), - output = output + output = output, + verbose = FALSE ) for (file in list.files(output, full.names = TRUE)) { date <- jsonlite::read_json(file, simplifyVector = TRUE)$date @@ -145,7 +148,8 @@ test_that("record_issues() date works", { checks = mock_meta_checks, packages = mock_meta_packages ), - output = output + output = output, + verbose = FALSE ) for (package in never_fixed) { path <- file.path(output, package) @@ -170,7 +174,8 @@ test_that("record_issues() on a small repo", { record_issues( repo = "https://wlandau.r-universe.dev", versions = versions, - output = output + output = output, + verbose = FALSE ) expect_true(dir.exists(output)) }) @@ -193,14 +198,17 @@ test_that("record_issues() with dependency problems", { meta_checks <- mock_meta_checks[1L, ] meta_checks$package <- "crew" meta_checks[["_winbinary"]] <- "failure" - record_issues( - versions = versions, - mock = list( - checks = meta_checks, - packages = mock_meta_packages_graph, - today = "2024-01-01" - ), - output = output + suppressMessages( + record_issues( + versions = versions, + mock = list( + checks = meta_checks, + packages = mock_meta_packages_graph, + today = "2024-01-01" + ), + output = output, + verbose = TRUE + ) ) expect_true(dir.exists(output)) expect_equal( From e41b66da573d4007a760d2f8f75e85f75ad4339a Mon Sep 17 00:00:00 2001 From: wlandau Date: Tue, 11 Jun 2024 10:05:17 -0400 Subject: [PATCH 16/17] default verbose = FALSE --- R/issues_dependencies.R | 2 +- R/record_issues.R | 2 +- man/issues_dependencies.Rd | 2 +- man/record_issues.Rd | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/R/issues_dependencies.R b/R/issues_dependencies.R index a7ffdbb..d18e540 100644 --- a/R/issues_dependencies.R +++ b/R/issues_dependencies.R @@ -41,7 +41,7 @@ issues_dependencies <- function( packages, meta = multiverse.internals::meta_packages(), - verbose = TRUE + verbose = FALSE ) { if (verbose) message("Constructing the package dependency graph") graph <- issues_dependencies_graph(meta) diff --git a/R/record_issues.R b/R/record_issues.R index b49a58c..c25335f 100644 --- a/R/record_issues.R +++ b/R/record_issues.R @@ -60,7 +60,7 @@ record_issues <- function( versions = "versions.json", output = "issues", mock = NULL, - verbose = TRUE + verbose = FALSE ) { today <- mock$today %||% format(Sys.Date(), fmt = "yyyy-mm-dd") checks <- mock$checks %||% meta_checks(repo = repo) diff --git a/man/issues_dependencies.Rd b/man/issues_dependencies.Rd index 6b6dfc2..e1e4b4a 100644 --- a/man/issues_dependencies.Rd +++ b/man/issues_dependencies.Rd @@ -7,7 +7,7 @@ issues_dependencies( packages, meta = multiverse.internals::meta_packages(), - verbose = TRUE + verbose = FALSE ) } \arguments{ diff --git a/man/record_issues.Rd b/man/record_issues.Rd index bbd0df2..373b76d 100644 --- a/man/record_issues.Rd +++ b/man/record_issues.Rd @@ -9,7 +9,7 @@ record_issues( versions = "versions.json", output = "issues", mock = NULL, - verbose = TRUE + verbose = FALSE ) } \arguments{ From 884b1a1206c8c95bad9e5063e1af23283d8d20f6 Mon Sep 17 00:00:00 2001 From: wlandau Date: Tue, 11 Jun 2024 10:11:16 -0400 Subject: [PATCH 17/17] ns --- R/issues_checks.R | 2 +- R/issues_dependencies.R | 2 +- R/issues_descriptions.R | 4 +--- man/issues_checks.Rd | 2 +- man/issues_dependencies.Rd | 6 +----- man/issues_descriptions.Rd | 2 +- 6 files changed, 6 insertions(+), 12 deletions(-) diff --git a/R/issues_checks.R b/R/issues_checks.R index 4c31e16..19749af 100644 --- a/R/issues_checks.R +++ b/R/issues_checks.R @@ -17,7 +17,7 @@ #' meta <- meta_checks(repo = "https://wlandau.r-universe.dev") #' issues <- issues_checks(meta = meta) #' str(issues) -issues_checks <- function(meta = multiverse.internals::meta_checks()) { +issues_checks <- function(meta = meta_checks()) { fields_check <- c( "_linuxdevel", "_macbinary", diff --git a/R/issues_dependencies.R b/R/issues_dependencies.R index d18e540..f5bf5fd 100644 --- a/R/issues_dependencies.R +++ b/R/issues_dependencies.R @@ -40,7 +40,7 @@ #' issues_dependencies(packages = c("crew", "mirai"), meta = meta) issues_dependencies <- function( packages, - meta = multiverse.internals::meta_packages(), + meta = meta_packages(), verbose = FALSE ) { if (verbose) message("Constructing the package dependency graph") diff --git a/R/issues_descriptions.R b/R/issues_descriptions.R index 91e5a67..ef86047 100644 --- a/R/issues_descriptions.R +++ b/R/issues_descriptions.R @@ -17,9 +17,7 @@ #' meta <- meta_packages(repo = "https://wlandau.r-universe.dev") #' issues <- issues_descriptions(meta = meta) #' str(issues) -issues_descriptions <- function( - meta = multiverse.internals::meta_packages() -) { +issues_descriptions <- function(meta = meta_packages()) { meta <- issues_descriptions_remotes(meta) fields <- "remotes" meta <- meta[, c("package", fields)] diff --git a/man/issues_checks.Rd b/man/issues_checks.Rd index 174c358..d6d293e 100644 --- a/man/issues_checks.Rd +++ b/man/issues_checks.Rd @@ -4,7 +4,7 @@ \alias{issues_checks} \title{Report issues from R-universe package check results.} \usage{ -issues_checks(meta = multiverse.internals::meta_checks()) +issues_checks(meta = meta_checks()) } \arguments{ \item{meta}{A data frame with R-universe package check results diff --git a/man/issues_dependencies.Rd b/man/issues_dependencies.Rd index e1e4b4a..4aa2f75 100644 --- a/man/issues_dependencies.Rd +++ b/man/issues_dependencies.Rd @@ -4,11 +4,7 @@ \alias{issues_dependencies} \title{Report package dependency issues} \usage{ -issues_dependencies( - packages, - meta = multiverse.internals::meta_packages(), - verbose = FALSE -) +issues_dependencies(packages, meta = meta_packages(), verbose = FALSE) } \arguments{ \item{packages}{Character vector of names of packages with other issues.} diff --git a/man/issues_descriptions.Rd b/man/issues_descriptions.Rd index 4c02658..2b9ffea 100644 --- a/man/issues_descriptions.Rd +++ b/man/issues_descriptions.Rd @@ -4,7 +4,7 @@ \alias{issues_descriptions} \title{Report \code{DESCRIPTION} file issues.} \usage{ -issues_descriptions(meta = multiverse.internals::meta_packages()) +issues_descriptions(meta = meta_packages()) } \arguments{ \item{meta}{A data frame with R-universe package check results