@@ -204,6 +204,13 @@ validate_codecheck_yml <- function(configuration) {
204204 stop(" Could not load codecheck configuration from input '" , configuration , " '" )
205205 }
206206
207+ # MUST have a non-empty certificate identifier matching the pattern NNNN-NNN
208+ assertthat :: assert_that(isTRUE(grepl(" ^\\ d{4}-\\ d{3}$" , codecheck_yml $ certificate )), # if certificate is missing, grepl returns a logical(0)
209+ msg = paste0(" The certificate identifier '" ,
210+ codecheck_yml $ certificate ,
211+ " ' is missing or invalid" )
212+ )
213+
207214 # MUST have manifest
208215 assertthat :: assert_that(assertthat :: has_name(codecheck_yml , " manifest" ),
209216 msg = paste0(" codecheck.yml must have a root-level node 'manifest'" ,
@@ -235,9 +242,8 @@ validate_codecheck_yml <- function(configuration) {
235242
236243 # Check if the paper_link contains a valid URL. We only check that it starts with https?://
237244 url_regex <- " ^https?://"
238- if (! grepl(url_regex , codecheck_yml $ paper $ reference )) {
239- warning(" The paper reference in the codecheck.yml is not a valid URL" )
240- }
245+ assertthat :: assert_that(grepl(url_regex , codecheck_yml $ paper $ reference ),
246+ msg = paste0(codecheck_yml $ paper $ reference , " is not a valid URL" ))
241247
242248 # if ORCID are used, they must be without URL prefix and valid form, actual checking requires login, see #11
243249 orcid_regex <- " ^(\\ d{4}\\ -\\ d{4}\\ -\\ d{4}\\ -\\ d{3}(\\ d|X))$"
0 commit comments