diff --git a/.zenodo.json b/.zenodo.json index 1021068d..9b3a4aab 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -1,6 +1,6 @@ { "title": "checklist: A Thorough and Strict Set of Checks for R Packages and Source Code", - "version": "0.3.0", + "version": "0.3.1", "license": "GPL-3.0", "upload_type": "software", "description": "

An opinionated set of rules for R packages and R source code\nprojects.<\/p>", diff --git a/CITATION.cff b/CITATION.cff index bbb8c986..4f76bf4c 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -25,4 +25,4 @@ identifiers: value: 10.5281/zenodo.4028303 - type: url value: https://inbo.github.io/checklist/ -version: 0.3.0 +version: 0.3.1 diff --git a/DESCRIPTION b/DESCRIPTION index b880fde8..b5173c0f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: checklist Title: A Thorough and Strict Set of Checks for R Packages and Source Code -Version: 0.3.0 +Version: 0.3.1 Authors@R: c( person("Thierry", "Onkelinx", , "thierry.onkelinx@inbo.be", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-8804-4216", affiliation = "Research Institute for Nature and Forest (INBO)")), diff --git a/NEWS.md b/NEWS.md index 10041db6..9274d53a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,9 @@ +# checklist 0.3.1 + +* Fixes two bugs in case `MIT` license was chosen +* GitHub Actions now uses the latest version of checklist as default when + checking packages or projects. + # checklist 0.3.0 * Improved `create_project()` and `setup_project()` which interactively guides diff --git a/R/check_description.R b/R/check_description.R index 42732d34..2f3312b6 100644 --- a/R/check_description.R +++ b/R/check_description.R @@ -250,6 +250,8 @@ Please send a pull request if you need support for this license.", if (current_license == "MIT + file LICENSE") { author <- this_desc$get_author(role = "cph") cph <- paste(c(author$given, author$family), collapse = " ") + cph <- gsub("([\\(\\)\\.\\\\\\|\\[\\]\\{\\}\\^\\$\\*\\+\\?])", + "\\\\\\1", cph, perl = TRUE) problems <- c( problems, "Copyright holder in LICENSE.md doesn't match the one in DESCRIPTION"[ diff --git a/R/check_filename.R b/R/check_filename.R index a535c4d5..d64d294b 100644 --- a/R/check_filename.R +++ b/R/check_filename.R @@ -98,7 +98,7 @@ check_filename <- function(x = ".") { "\\.[a-zA-Z]+ignore", "\\.Rprofile", "\\.[a-zA-Z]+\\.(json|yml)", "CITATION", "DESCRIPTION", "NAMESPACE", "CITATION\\.cff", "README\\.R?md", "NEWS\\.md", - "CODE_OF_CONDUCT\\.md", "CONTRIBUTING\\.md", "LICENSE\\.(md)?", + "CODE_OF_CONDUCT\\.md", "CONTRIBUTING\\.md", "LICENSE(\\.md)?", "SUPPORT\\.md", "SECURITY\\.md", "FUNDING\\.yml", "Dockerfile", "WORDLIST.*", "docker-compose.*\\.yml" ), diff --git a/inst/CITATION b/inst/CITATION index 52ce1391..3862c829 100644 --- a/inst/CITATION +++ b/inst/CITATION @@ -2,12 +2,12 @@ citHeader("To cite `checklist` in publications please use:") # begin checklist entry citEntry( entry = "Manual", - title = "checklist: A Thorough and Strict Set of Checks for R Packages and Source Code. Version 0.3.0", + title = "checklist: A Thorough and Strict Set of Checks for R Packages and Source Code. Version 0.3.1", author = c( author = c(person(given = "Thierry", family = "Onkelinx"))), year = 2023, url = "https://inbo.github.io/checklist/", abstract = "An opinionated set of rules for R packages and R source code projects.", - textVersion = "Onkelinx, Thierry (2023) checklist: A Thorough and Strict Set of Checks for R Packages and Source Code. Version 0.3.0. https://github.com/inbo/checklist/; https://inbo.github.io/checklist/", + textVersion = "Onkelinx, Thierry (2023) checklist: A Thorough and Strict Set of Checks for R Packages and Source Code. Version 0.3.1. https://github.com/inbo/checklist/; https://inbo.github.io/checklist/", keywords = "quality control; documentation; publication", doi = "10.5281/zenodo.4028303", ) diff --git a/inst/package_template/check_on_branch.yml b/inst/package_template/check_on_branch.yml index 945a058a..bc635a07 100644 --- a/inst/package_template/check_on_branch.yml +++ b/inst/package_template/check_on_branch.yml @@ -17,4 +17,4 @@ jobs: permissions: contents: read steps: - - uses: inbo/actions/check_pkg@checklist-0.3.0 + - uses: inbo/actions/check_pkg@main diff --git a/inst/package_template/check_on_main.yml b/inst/package_template/check_on_main.yml index beaf488a..6e8268dc 100644 --- a/inst/package_template/check_on_main.yml +++ b/inst/package_template/check_on_main.yml @@ -16,4 +16,4 @@ jobs: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: inbo/actions/check_pkg@checklist-0.3.0 + - uses: inbo/actions/check_pkg@main diff --git a/inst/project_template/check_project.yml b/inst/project_template/check_project.yml index 39502089..80fabe30 100644 --- a/inst/project_template/check_project.yml +++ b/inst/project_template/check_project.yml @@ -14,4 +14,4 @@ jobs: permissions: contents: read steps: - - uses: inbo/actions/check_project@v2 + - uses: inbo/actions/check_project@main diff --git a/tests/testthat/test_d_check_license.R b/tests/testthat/test_d_check_license.R index 79813ef9..22fe7822 100644 --- a/tests/testthat/test_d_check_license.R +++ b/tests/testthat/test_d_check_license.R @@ -6,8 +6,27 @@ test_that("check_license() works", { email = "thierry.onkelinx@inbo.be", comment = c(ORCID = "0000-0001-8804-4216") ) + change_cph <- function(cph = "test escape characters ().[]") { + descr <- readLines(path(repo, "DESCRIPTION")) + cph_line <- grep("cph", descr, value = FALSE) + new_cph <- paste0( + " person(\"", cph, + "\", , , \"info@inbo.be\", role = c(\"cph\", \"fnd\"))" + ) + descr[cph_line] <- new_cph + writeLines(descr, path(repo, "DESCRIPTION")) + license <- readLines(path(repo, "LICENSE")) + license[2] <- paste0("COPYRIGHT HOLDER: ", cph) + writeLines(license, path(repo, "LICENSE")) + license_md <- readLines(path(repo, "LICENSE.md")) + license_md[3] <- paste0("Copyright (c) ", format(Sys.Date(), "%Y"), + " ", cph) + writeLines(license_md, path(repo, "LICENSE.md")) + } path <- tempfile("check_license") dir.create(path) + oldwd <- setwd(path) + on.exit(setwd(oldwd), add = TRUE) on.exit(unlink(path, recursive = TRUE), add = TRUE) package <- "checklicense" @@ -33,6 +52,12 @@ test_that("check_license() works", { file.exists(path(repo, "LICENSE")), TRUE ) + x <- check_license(repo) + expect_identical( + x$.__enclos_env__$private$errors$license, + character(0) + ) + # copyright holder mismatch mit[3] <- paste0("Copyright (c) ", format(Sys.Date(), "%Y"), " INBO") @@ -43,6 +68,13 @@ test_that("check_license() works", { c("Copyright holder in LICENSE.md doesn't match the one in DESCRIPTION", "Copyright statement in LICENSE.md not in correct format")) + # test all escape characters in copyright holder + change_cph() + x <- check_license(repo) + expect_identical( + x$.__enclos_env__$private$errors$license, + character(0) + ) file_delete(path(repo, "LICENSE.md")) expect_is(x <- check_license(repo), "checklist")