From 6164006becf0ecdb8670b66d379a84e366d71787 Mon Sep 17 00:00:00 2001 From: Diego H Date: Fri, 9 Aug 2024 20:12:01 +0200 Subject: [PATCH] No DOI on base packages --- R/utils-create.R | 9 ++++++++- README.md | 3 --- codemeta.json | 2 +- inst/WORDLIST | 6 +----- tests/testthat/test-cff_create.R | 3 +++ tests/testthat/test-cff_read.R | 4 ++++ 6 files changed, 17 insertions(+), 10 deletions(-) diff --git a/R/utils-create.R b/R/utils-create.R index 8a9e8ee..2c13cb0 100644 --- a/R/utils-create.R +++ b/R/utils-create.R @@ -154,7 +154,14 @@ get_dependencies <- function(desc_path, mod$abstract <- mod$title mod$title <- n$package # If on CRAN add CRAN DOI - if (!is.null(n$package)) { + # Base packs + base_pkgs <- rownames(installed.packages(priority = "base")) + + cran_doi <- all( + n$package %in% avail_on_init$Package, + !n$package %in% base_pkgs + ) + if (cran_doi) { mod$doi <- paste0("10.32614/CRAN.package.", n$package) } } diff --git a/README.md b/README.md index c4f42fa..c58095d 100644 --- a/README.md +++ b/README.md @@ -420,7 +420,6 @@ test <- cff_create("rmarkdown") name: R Foundation for Statistical Computing address: Vienna, Austria year: '2024' - doi: 10.32614/CRAN.package.methods - type: software title: tinytex abstract: 'tinytex: Helper Functions to Install and Maintain TeX Live, and Compile @@ -446,7 +445,6 @@ test <- cff_create("rmarkdown") name: R Foundation for Statistical Computing address: Vienna, Austria year: '2024' - doi: 10.32614/CRAN.package.tools - type: software title: utils abstract: 'R: A Language and Environment for Statistical Computing' @@ -457,7 +455,6 @@ test <- cff_create("rmarkdown") name: R Foundation for Statistical Computing address: Vienna, Austria year: '2024' - doi: 10.32614/CRAN.package.utils - type: software title: xfun abstract: 'xfun: Supporting Functions for Packages Maintained by ''Yihui Xie''' diff --git a/codemeta.json b/codemeta.json index b6bfd9b..241cd7c 100644 --- a/codemeta.json +++ b/codemeta.json @@ -200,7 +200,7 @@ }, "isPartOf": "https://ropensci.org", "keywords": ["attribution", "citation", "credit", "citation-files", "cff", "metadata", "r", "r-package", "citation-file-format", "rstats", "ropensci", "cran"], - "fileSize": "1623.723KB", + "fileSize": "1624.56KB", "citation": [ { "@type": "ScholarlyArticle", diff --git a/inst/WORDLIST b/inst/WORDLIST index 7fc3f92..e508878 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -14,7 +14,6 @@ CRC Cabunoc Chue CodeMeta -DOI Decoret Druskat Easi @@ -46,7 +45,6 @@ Pérez README RSPM RStudio -Reproducibility Riederer SPDX Spaaks @@ -54,7 +52,6 @@ Suárez Waldir Wickham Willighagen -YAML Zenodo Zotero al @@ -78,13 +75,12 @@ inproceedings json jsonvalidate nd +orcid pak param plaintext pre rOpenSci -repo -repos rmarkdown schemas testthat diff --git a/tests/testthat/test-cff_create.R b/tests/testthat/test-cff_create.R index e679ebf..591fe61 100644 --- a/tests/testthat/test-cff_create.R +++ b/tests/testthat/test-cff_create.R @@ -554,6 +554,9 @@ test_that("Coerce keywords from GH", { cffobj1 <- cff_create(tmp) expect_true(cff_validate(cffobj1, verbose = FALSE)) + + skip_if(is.null(cffobj1$keywords), "keywords not gathered") + expect_false(is.null(cffobj1$keywords)) # Concatenate keywords of both sources diff --git a/tests/testthat/test-cff_read.R b/tests/testthat/test-cff_read.R index d5a634c..c68e0f5 100644 --- a/tests/testthat/test-cff_read.R +++ b/tests/testthat/test-cff_read.R @@ -60,6 +60,10 @@ test_that("cff_read DESCRIPTION", { fno <- cff_read_description(f, gh_keywords = FALSE) f2 <- cff_read_description(f, gh_keywords = TRUE) + # In some instances keywords are not retrieved + skip_if(is.null(f2$keywords), "keywords not gathered") + + expect_false(is.null(f2$keywords)) expect_gt(length(f2$keywords), length(fno$keywords)) })