Skip to content

Commit 199cbab

Browse files
committed
Enhances Zenodo integration (include community submission), fix some R CMD check stuff
1 parent 7e90f7a commit 199cbab

19 files changed

Lines changed: 88 additions & 63 deletions

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@
1313
^CONTRIBUTING\.md$
1414
^CLAUDE\.md$
1515
^\.claude$
16+
^LICENSE\.md$

DESCRIPTION

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ Authors@R:
2424
comment = c(ORCID = "0000-0002-1322-1553"))
2525
)
2626
Description: This contains helper functions for codecheckers for conducting CODECHECKs, e.g., authoring CODECHECK certificates (<https://codecheck.org.uk>), and the rendering of the CODECHECK Register (<https://codecheck.org.uk/register/>).
27-
License: MIT + file LICENSE
27+
License: MIT
28+
License_is_FOSS: yes
2829
Depends: R (>= 4.0.0), gh, R.cache, parsedate
2930
Imports:
3031
dplyr,

LICENSE renamed to LICENSE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
MIT License
1+
# MIT License
22

3-
Copyright (c) 2020 CODECHECK
3+
Copyright (c) 2025 codecheck authors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

NEWS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@
103103
- Preserves all other fields in codecheck.yml during update
104104
- New yml_file parameter allows specifying alternate YAML file location
105105
- Comprehensive test suite with 31 tests using mocked Zenodo API
106+
* **Automatic CODECHECK community submission**: `get_or_create_zenodo_record()` now automatically submits new records to the CODECHECK community
107+
- Newly created Zenodo records are automatically submitted to https://zenodo.org/communities/codecheck/
108+
- Uses zen4R's `createReviewRequest()` and `submitRecordForReview()` methods
109+
- Record will be added to the community after publication
110+
- Graceful error handling if community submission fails - provides warning with manual instructions
111+
- Ensures all CODECHECK certificates are discoverable in the central community
106112
* **Zenodo curation policy compliance**: `upload_zenodo_metadata()` now fully complies with CODECHECK Zenodo community curation policy
107113
- Publisher set to "CODECHECK Community on Zenodo" (was "CODECHECK")
108114
- Resource type set to "publication-report" (was "publication-preprint")

R/github.R

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
##' \item{issue_number}{The GitHub issue number (if found)}
2323
##' \item{was_placeholder}{Logical indicating if original was a placeholder}
2424
##' }
25-
##' @author Daniel Nüst
25+
##' @author Daniel Nuest
2626
##' @importFrom yaml read_yaml write_yaml
2727
##' @export
2828
##' @examples
@@ -60,7 +60,7 @@ update_certificate_from_github <- function(yml_file = "codecheck.yml",
6060

6161
# Check if we should proceed
6262
if (!is_placeholder && !force) {
63-
message("\n Certificate ID is already set and is not a placeholder.")
63+
message("\n\u26a0 Certificate ID is already set and is not a placeholder.")
6464
message("Use force = TRUE to update anyway.")
6565
message(rep("=", 80), "\n")
6666

@@ -79,13 +79,13 @@ update_certificate_from_github <- function(yml_file = "codecheck.yml",
7979
result <- tryCatch({
8080
get_certificate_from_github_issue(yml_file, state = issue_state)
8181
}, error = function(e) {
82-
message(" Error retrieving from GitHub: ", e$message)
82+
message("\u2716 Error retrieving from GitHub: ", e$message)
8383
return(NULL)
8484
})
8585

8686
# Check if we found a result
8787
if (is.null(result)) {
88-
message("\n No certificate found in GitHub issues")
88+
message("\n\u2716 No certificate found in GitHub issues")
8989
message(rep("=", 80), "\n")
9090

9191
return(invisible(list(
@@ -98,7 +98,7 @@ update_certificate_from_github <- function(yml_file = "codecheck.yml",
9898

9999
# Check if we have a certificate
100100
if (is.null(result$certificate)) {
101-
message("\n No certificate ID found in matching issues")
101+
message("\n\u2716 No certificate ID found in matching issues")
102102
if (!is.null(result$message)) {
103103
message("Reason: ", result$message)
104104
}
@@ -113,7 +113,7 @@ update_certificate_from_github <- function(yml_file = "codecheck.yml",
113113
}
114114

115115
# We have a certificate!
116-
message("\n Found certificate: ", result$certificate)
116+
message("\n\u2713 Found certificate: ", result$certificate)
117117
message(" Issue #", result$issue_number, ": ", result$title)
118118
if (!is.null(result$matched_author)) {
119119
message(" Matched author: ", result$matched_author)
@@ -137,17 +137,17 @@ update_certificate_from_github <- function(yml_file = "codecheck.yml",
137137
# Write back to file
138138
tryCatch({
139139
yaml::write_yaml(metadata, yml_file)
140-
message(" Successfully updated ", yml_file)
140+
message("\u2713 Successfully updated ", yml_file)
141141
message(" Certificate ID: ", result$certificate)
142142
message(" From GitHub issue #", result$issue_number)
143143

144144
updated <- TRUE
145145
}, error = function(e) {
146-
message(" Failed to write file: ", e$message)
146+
message("\u2716 Failed to write file: ", e$message)
147147
updated <- FALSE
148148
})
149149
} else {
150-
message("\n No changes applied. Use apply_update = TRUE to save changes.")
150+
message("\n\u26a0 No changes applied. Use apply_update = TRUE to save changes.")
151151
updated <- FALSE
152152
}
153153

R/lifecycle.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
##' \item{reference}{The DOI URL}
1717
##' \item{date}{Publication date}
1818
##' }
19-
##' @author Daniel Nüst
19+
##' @author Daniel Nuest
2020
##' @importFrom httr GET content status_code
2121
##' @importFrom jsonlite fromJSON
2222
##' @export
@@ -107,7 +107,7 @@ get_lifecycle_metadata <- function(identifier) {
107107
##' non-empty fields. If \code{FALSE} (default), only populate empty or
108108
##' placeholder fields.
109109
##' @return Invisibly returns the updated metadata list
110-
##' @author Daniel Nüst
110+
##' @author Daniel Nuest
111111
##' @importFrom yaml read_yaml write_yaml
112112
##' @export
113113
##' @examples
@@ -225,9 +225,9 @@ update_codecheck_yml_from_lifecycle <- function(identifier,
225225

226226
if (apply_updates) {
227227
yaml::write_yaml(updated, yml_file)
228-
cat("\n Changes applied to ", yml_file, "\n\n", sep = "")
228+
cat("\n\u2713 Changes applied to ", yml_file, "\n\n", sep = "")
229229
} else {
230-
cat("\n No changes applied. Use apply_updates = TRUE to save changes.\n\n")
230+
cat("\n\u26a0 No changes applied. Use apply_updates = TRUE to save changes.\n\n")
231231
}
232232
} else {
233233
cat("\nNo changes needed. All fields are already populated.\n")

R/validation.R

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
##' \item{missing}{List of missing fields by category (mandatory, recommended, optional)}
2626
##' \item{updated}{The updated metadata list (if changes were made)}
2727
##' }
28-
##' @author Daniel Nüst
28+
##' @author Daniel Nuest
2929
##' @importFrom yaml read_yaml write_yaml
3030
##' @export
3131
##' @examples
@@ -246,9 +246,9 @@ complete_codecheck_yml <- function(yml_file = "codecheck.yml",
246246

247247
if (apply_updates) {
248248
yaml::write_yaml(updated, yml_file)
249-
cat("\n Changes applied to ", yml_file, "\n\n", sep = "")
249+
cat("\n\u2713 Changes applied to ", yml_file, "\n\n", sep = "")
250250
} else {
251-
cat("\n No changes applied. Use apply_updates = TRUE to save changes.\n\n")
251+
cat("\n\u26a0 No changes applied. Use apply_updates = TRUE to save changes.\n\n")
252252
}
253253
} else {
254254
if (add_mandatory || add_optional) {
@@ -287,7 +287,7 @@ complete_codecheck_yml <- function(yml_file = "codecheck.yml",
287287
##' \item{issues}{Character vector of any issues found}
288288
##' \item{crossref_metadata}{The metadata retrieved from CrossRef (if available)}
289289
##' }
290-
##' @author Daniel Nüst
290+
##' @author Daniel Nuest
291291
##' @importFrom httr GET content status_code
292292
##' @export
293293
##' @examples
@@ -394,7 +394,7 @@ validate_codecheck_yml_crossref <- function(yml_file = "codecheck.yml",
394394
issues <- c(issues, issue)
395395
warning(issue)
396396
} else {
397-
message(" Title matches CrossRef metadata")
397+
message("\u2713 Title matches CrossRef metadata")
398398
}
399399
}
400400

@@ -447,7 +447,7 @@ validate_codecheck_yml_crossref <- function(yml_file = "codecheck.yml",
447447
issues <- c(issues, issue)
448448
warning(issue)
449449
} else {
450-
message(" Author ", i, " name matches: ", local_author$name)
450+
message("\u2713 Author ", i, " name matches: ", local_author$name)
451451
}
452452
}
453453

@@ -465,11 +465,11 @@ validate_codecheck_yml_crossref <- function(yml_file = "codecheck.yml",
465465
issues <- c(issues, issue)
466466
warning(issue)
467467
} else {
468-
message(" Author ", i, " ORCID matches: ", local_orcid)
468+
message("\u2713 Author ", i, " ORCID matches: ", local_orcid)
469469
}
470470
} else {
471471
msg <- paste0("Author ", i, " has ORCID in local file but not in CrossRef")
472-
message(" ", msg)
472+
message("\u2139 ", msg)
473473
}
474474
}
475475
}
@@ -479,13 +479,13 @@ validate_codecheck_yml_crossref <- function(yml_file = "codecheck.yml",
479479
valid <- length(issues) == 0
480480

481481
if (!valid) {
482-
message("\n Validation completed with ", length(issues), " issue(s)")
482+
message("\n\u26a0 Validation completed with ", length(issues), " issue(s)")
483483
if (strict) {
484484
stop("Validation failed with ", length(issues), " issue(s):\n",
485485
paste(issues, collapse = "\n"))
486486
}
487487
} else {
488-
message("\n All validations passed!")
488+
message("\n\u2713 All validations passed!")
489489
}
490490

491491
invisible(list(
@@ -513,7 +513,7 @@ validate_codecheck_yml_crossref <- function(yml_file = "codecheck.yml",
513513
##' \item{valid}{Logical indicating if all checks passed}
514514
##' \item{issues}{Character vector of any issues found}
515515
##' }
516-
##' @author Daniel Nüst
516+
##' @author Daniel Nuest
517517
##' @importFrom rorcid orcid_person
518518
##' @export
519519
##' @examples
@@ -624,10 +624,10 @@ validate_codecheck_yml_orcid <- function(yml_file = "codecheck.yml",
624624
issues <- c(issues, issue)
625625
warning(issue)
626626
} else {
627-
message(" Author ", i, " name matches ORCID: ", author$name, " (", author$ORCID, ")")
627+
message("\u2713 Author ", i, " name matches ORCID: ", author$name, " (", author$ORCID, ")")
628628
}
629629
} else {
630-
message(" Could not retrieve ORCID record for author ", i, ": ", author$ORCID)
630+
message("\u2139 Could not retrieve ORCID record for author ", i, ": ", author$ORCID)
631631
}
632632
}
633633
}
@@ -653,7 +653,7 @@ validate_codecheck_yml_orcid <- function(yml_file = "codecheck.yml",
653653
next
654654
}
655655

656-
message(" Codechecker ", i, ": ", checker$name)
656+
message("\u2713 Codechecker ", i, ": ", checker$name)
657657

658658
# Validate ORCID if present
659659
if (!is.null(checker$ORCID)) {
@@ -690,10 +690,10 @@ validate_codecheck_yml_orcid <- function(yml_file = "codecheck.yml",
690690
issues <- c(issues, issue)
691691
warning(issue)
692692
} else {
693-
message(" Codechecker ", i, " ORCID matches: ", checker$name, " (", checker$ORCID, ")")
693+
message("\u2713 Codechecker ", i, " ORCID matches: ", checker$name, " (", checker$ORCID, ")")
694694
}
695695
} else {
696-
message(" Could not retrieve ORCID record for codechecker ", i, ": ", checker$ORCID)
696+
message("\u2139 Could not retrieve ORCID record for codechecker ", i, ": ", checker$ORCID)
697697
}
698698
}
699699
}
@@ -704,13 +704,13 @@ validate_codecheck_yml_orcid <- function(yml_file = "codecheck.yml",
704704
valid <- length(issues) == 0
705705

706706
if (!valid) {
707-
message("\n ORCID validation completed with ", length(issues), " issue(s)")
707+
message("\n\u26a0 ORCID validation completed with ", length(issues), " issue(s)")
708708
if (strict) {
709709
stop("ORCID validation failed with ", length(issues), " issue(s):\n",
710710
paste(issues, collapse = "\n"))
711711
}
712712
} else {
713-
message("\n All ORCID validations passed!")
713+
message("\n\u2713 All ORCID validations passed!")
714714
}
715715

716716
invisible(list(
@@ -739,7 +739,7 @@ validate_codecheck_yml_orcid <- function(yml_file = "codecheck.yml",
739739
##' \item{crossref_result}{Results from CrossRef validation (if performed)}
740740
##' \item{orcid_result}{Results from ORCID validation (if performed)}
741741
##' }
742-
##' @author Daniel Nüst
742+
##' @author Daniel Nuest
743743
##' @export
744744
##' @examples
745745
##' \dontrun{
@@ -805,7 +805,7 @@ validate_contents_references <- function(yml_file = "codecheck.yml",
805805
if (!is.null(orcid_result)) total_issues <- total_issues + length(orcid_result$issues)
806806

807807
message("\n", rep("=", 80))
808-
message(" VALIDATION SUMMARY: ", total_issues, " issue(s) found")
808+
message("\u26a0 VALIDATION SUMMARY: ", total_issues, " issue(s) found")
809809
message(rep("=", 80))
810810

811811
if (strict) {
@@ -818,7 +818,7 @@ validate_contents_references <- function(yml_file = "codecheck.yml",
818818
}
819819
} else {
820820
message("\n", rep("=", 80))
821-
message(" ALL VALIDATIONS PASSED!")
821+
message("\u2713 ALL VALIDATIONS PASSED!")
822822
message(rep("=", 80))
823823
}
824824

@@ -874,7 +874,7 @@ is_doi_placeholder <- function(report_doi) {
874874
##' for placeholder patterns.
875875
##' @return Logical value: TRUE if certificate or DOI is a placeholder, FALSE otherwise.
876876
##' If strict=TRUE and either is a placeholder, stops with an error instead.
877-
##' @author Daniel Nüst
877+
##' @author Daniel Nuest
878878
##' @export
879879
##' @examples
880880
##' \dontrun{
@@ -988,7 +988,7 @@ is_placeholder_certificate <- function(yml_file = "codecheck.yml",
988988
##' @param display_warning Logical. If TRUE (default), displays a warning box in
989989
##' the rendered output when certificate or DOI is a placeholder.
990990
##' @return Invisibly returns TRUE if certificate and DOI are valid, FALSE if any placeholder
991-
##' @author Daniel Nüst
991+
##' @author Daniel Nuest
992992
##' @export
993993
##' @examples
994994
##' \dontrun{
@@ -1066,7 +1066,7 @@ validate_certificate_for_rendering <- function(yml_file = "codecheck.yml",
10661066
if (display_warning) {
10671067
cat("\\begin{center}\n")
10681068
cat("\\fcolorbox{red}{yellow}{\\parbox{0.9\\textwidth}{\\centering\n")
1069-
cat("\\textbf{\\Large \\textcolor{red}{} WARNING \\textcolor{red}{}}\\\\\n")
1069+
cat("\\textbf{\\Large \\textcolor{red}{\u26a0} WARNING \\textcolor{red}{\u26a0}}\\\\\n")
10701070
cat("\\vspace{0.2cm}\n")
10711071

10721072
# Display each warning part

0 commit comments

Comments
 (0)