From a39f4a55edc99cccbf6f9ee106d1f07d9996e3f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?zxBIB=20Lech=C3=B3n=2CMiguel=20=28MED=20BDS=29=20EXTERNAL?= Date: Thu, 23 Jan 2025 17:19:41 +0100 Subject: [PATCH] Patch check generator with feedback from PR. --- R/CM.R | 11 +++++------ R/check_call_auto.R | 12 +++++++++--- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/R/CM.R b/R/CM.R index 03b606c..15de061 100644 --- a/R/CM.R +++ b/R/CM.R @@ -1,4 +1,4 @@ -# YT#VHadccc0c551b3269937d087c1e76ae699#VHde6a9599edfe700035a3a72b3c9bdf71# +# YT#VH0ae1b0c3bf862b3b93194fa0f023686d#VHd74cfd54b905c92b95c251b87af2e842# CM <- local({ # _C_hecked _M_odule message_well <- function(title, contents, color = "f5f5f5") { # repeats #iewahg style <- sprintf(r"---( @@ -280,7 +280,9 @@ CM <- local({ # _C_hecked _M_odule elem_name, elem_name, elem_name, elem$arg_count )) } else { - push(sprintf("'TODO: %s (%s)'\n", elem_name, elem$kind)) + push(sprintf("'NOTE: %s (%s) has no associated automated checks'\n", elem_name, elem$kind)) + push(sprintf("' The expectation is that it either does not require them or that'\n")) + push(sprintf("' the caller of this function has written manual checks near the call site.'\n")) } } @@ -408,7 +410,7 @@ CM <- local({ # _C_hecked _M_odule return(res) } - # TODO: Extend to all checker functions + # TODO: use check_flags instead and remove optional_and_empty <- function(flags, value) { return(isTRUE(flags[["optional"]]) && length(value) == 0) } @@ -510,9 +512,6 @@ CM <- local({ # _C_hecked _M_odule } check_choice_from_col_contents <- function(name, value, flags, dataset_name, dataset_value, column, warn, err) { - if (optional_and_empty(flags, value)) { - return(TRUE) - } ok <- check_flags(name, value, flags, warn, err) && assert( err, all(value %in% dataset_value[[column]]), diff --git a/R/check_call_auto.R b/R/check_call_auto.R index 7d36ee1..16c2c2c 100644 --- a/R/check_call_auto.R +++ b/R/check_call_auto.R @@ -11,9 +11,15 @@ check_mod_listings_auto <- function(afmm, datasets, module_id, dataset_names, de flags <- list(one_or_more = TRUE) OK[["dataset_names"]] <- CM$check_dataset_name("dataset_names", dataset_names, flags, datasets, used_dataset_names, warn, err) - "TODO: default_vars (group)" - "TODO: pagination (group)" - "TODO: intended_use_label (group)" + "NOTE: default_vars (group) has no associated automated checks" + " The expectation is that it does not require one or that" + " the caller of this function has written manual checks near the call site." + "NOTE: pagination (group) has no associated automated checks" + " The expectation is that it does not require one or that" + " the caller of this function has written manual checks near the call site." + "NOTE: intended_use_label (group) has no associated automated checks" + " The expectation is that it does not require one or that" + " the caller of this function has written manual checks near the call site." return(OK) }