-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #103 from inbo/fix-license
fix license and filename checks
- Loading branch information
Showing
11 changed files
with
49 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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", , "[email protected]", role = c("aut", "cre"), | ||
comment = c(ORCID = "0000-0001-8804-4216", affiliation = "Research Institute for Nature and Forest (INBO)")), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,27 @@ test_that("check_license() works", { | |
email = "[email protected]", | ||
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, | ||
"\", , , \"[email protected]\", 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") | ||
|