diff --git a/R/issues_descriptions.R b/R/issues_descriptions.R index fff9ead..950bf91 100644 --- a/R/issues_descriptions.R +++ b/R/issues_descriptions.R @@ -25,7 +25,7 @@ issues_descriptions <- function(meta) { } issues_descriptions_remotes <- function(meta) { - meta[["remotes"]] <- meta[["remotes"]] %|||% replicate(nrow(meta), NULL) + meta[["remotes"]] <- meta[["remotes"]] %||% replicate(nrow(meta), NULL) meta$remotes <- lapply(meta$remotes, function(x) x[nzchar(x)]) meta[vapply(meta$remotes, length, integer(1L)) > 0L, ] } diff --git a/R/record_issues.R b/R/record_issues.R index 3a2ca96..be17eb9 100644 --- a/R/record_issues.R +++ b/R/record_issues.R @@ -24,9 +24,9 @@ #' an issue was first noticed. It automatically resets the next time #' all package are resolved. #' @return `NULL` (invisibly). -#' @inheritParams meta_checks #' @inheritParams issues_checks #' @inheritParams issues_versions +#' @inheritParams meta_checks #' @param output Character of length 1, file path to the folder to record #' new package issues. Each call to `record_issues()` overwrites the #' contents of the repo. @@ -60,9 +60,9 @@ record_issues <- function( output = "issues", mock = NULL ) { - today <- mock$today %|||% format(Sys.Date(), fmt = "yyyy-mm-dd") - checks <- mock$checks %|||% meta_checks(repo = repo) - packages <- mock$packages %|||% meta_packages(repo = repo) + today <- mock$today %||% format(Sys.Date(), fmt = "yyyy-mm-dd") + checks <- mock$checks %||% meta_checks(repo = repo) + packages <- mock$packages %||% meta_packages(repo = repo) issues <- list() |> add_issues(issues_checks(meta = checks), "checks") |> add_issues(issues_descriptions(meta = packages), "descriptions") |> @@ -107,7 +107,7 @@ overwrite_package_issues <- function( dates ) { path <- file.path(output, package) - issues[[package]]$date <- dates[[package]] %|||% today + issues[[package]]$date <- dates[[package]] %||% today jsonlite::write_json( x = issues[[package]], path = file.path(output, package), diff --git a/R/record_versions.R b/R/record_versions.R index 1504846..1b82186 100644 --- a/R/record_versions.R +++ b/R/record_versions.R @@ -12,12 +12,12 @@ #' @inheritSection record_issues Package issues #' @return `NULL` (invisibly). Writes a package version manifest #' and a manifest of version issues as JSON files. +#' @inheritParams meta_checks #' @param versions Character of length 1, file path to a JSON manifest #' tracking the history of released versions of packages. #' The official versions file for R-multiverse is maintained and #' updated periodically at #' . -#' @param repo Character string of package repositories to track. #' @param current A data frame of current versions and hashes of packages #' in `repo`. This argument is exposed for testing only. #' @examples diff --git a/R/review_pull_request.R b/R/review_pull_request.R index 5188e70..bdbc003 100644 --- a/R/review_pull_request.R +++ b/R/review_pull_request.R @@ -10,8 +10,8 @@ #' 4. Add a file in a forbidden place (close). #' 5. Add a custom JSON file which can be parsed (manual review). #' @return `NULL` (invisibly). -#' @param owner Character of length 1, name of the universe repository owner. -#' @param repo Character of length 1, name of the universe repository. +#' @inheritParams meta_checks +#' @param owner Character of length 1, name of the package repository owner. #' @param number Positive integer of length 1, index of the pull request #' in the repo. review_pull_request <- function( diff --git a/R/utils_logic.R b/R/utils_logic.R deleted file mode 100644 index b8794e2..0000000 --- a/R/utils_logic.R +++ /dev/null @@ -1,15 +0,0 @@ -`%||%` <- function(x, y) { - if (length(x) > 0L) { - x - } else { - y - } -} - -`%|||%` <- function(x, y) { - if (is.null(x)) { - y - } else { - x - } -} diff --git a/man/get_current_versions.Rd b/man/get_current_versions.Rd index 2821199..cdba07c 100644 --- a/man/get_current_versions.Rd +++ b/man/get_current_versions.Rd @@ -7,7 +7,8 @@ get_current_versions(repo = "https://multiverse.r-multiverse.org") } \arguments{ -\item{repo}{Character string of package repositories to track.} +\item{repo}{Character of length 1, URL of the package repository. +R-multiverse uses \code{"https://multiverse.r-multiverse.org"}.} } \value{ A data frame of packages with their current versions and hashes. diff --git a/man/record_versions.Rd b/man/record_versions.Rd index 62d1235..2648fa0 100644 --- a/man/record_versions.Rd +++ b/man/record_versions.Rd @@ -17,7 +17,8 @@ The official versions file for R-multiverse is maintained and updated periodically at \url{https://github.com/r-multiverse/checks/blob/main/versions.json}.} -\item{repo}{Character string of package repositories to track.} +\item{repo}{Character of length 1, URL of the package repository. +R-multiverse uses \code{"https://multiverse.r-multiverse.org"}.} \item{current}{A data frame of current versions and hashes of packages in \code{repo}. This argument is exposed for testing only.} diff --git a/man/review_pull_request.Rd b/man/review_pull_request.Rd index 59fca48..036a8bf 100644 --- a/man/review_pull_request.Rd +++ b/man/review_pull_request.Rd @@ -7,9 +7,10 @@ review_pull_request(owner = "r-multiverse", repo = "contributions", number) } \arguments{ -\item{owner}{Character of length 1, name of the universe repository owner.} +\item{owner}{Character of length 1, name of the package repository owner.} -\item{repo}{Character of length 1, name of the universe repository.} +\item{repo}{Character of length 1, URL of the package repository. +R-multiverse uses \code{"https://multiverse.r-multiverse.org"}.} \item{number}{Positive integer of length 1, index of the pull request in the repo.} diff --git a/man/review_pull_requests.Rd b/man/review_pull_requests.Rd index f4bde69..3499642 100644 --- a/man/review_pull_requests.Rd +++ b/man/review_pull_requests.Rd @@ -7,9 +7,10 @@ review_pull_requests(owner = "r-multiverse", repo = "contributions") } \arguments{ -\item{owner}{Character of length 1, name of the universe repository owner.} +\item{owner}{Character of length 1, name of the package repository owner.} -\item{repo}{Character of length 1, name of the universe repository.} +\item{repo}{Character of length 1, URL of the package repository. +R-multiverse uses \code{"https://multiverse.r-multiverse.org"}.} } \value{ \code{NULL} (invisibly). diff --git a/tests/testthat/test-issues_checks.R b/tests/testthat/test-issues_checks.R index 862a994..5babb1e 100644 --- a/tests/testthat/test-issues_checks.R +++ b/tests/testthat/test-issues_checks.R @@ -49,5 +49,4 @@ test_that("issues_checks() on a small repo", { meta <- meta_checks(repo = "https://wlandau.r-universe.dev") issues <- issues_checks(meta = meta) expect_true(is.list(issues)) - expect_named(issues) }) diff --git a/tests/testthat/test-utils_logic.R b/tests/testthat/test-utils_logic.R deleted file mode 100644 index efc9611..0000000 --- a/tests/testthat/test-utils_logic.R +++ /dev/null @@ -1,11 +0,0 @@ -test_that("%||%", { - expect_equal("a" %||% "b", "a") - expect_equal(list() %||% "b", "b") - expect_equal(NULL %||% "b", "b") -}) - -test_that("%|||%", { - expect_equal("a" %|||% "b", "a") - expect_equal(list() %|||% "b", list()) - expect_equal(NULL %|||% "b", "b") -})