Skip to content

Commit

Permalink
Patch check generator with feedback from PR.
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-ebs-ext committed Jan 23, 2025
1 parent 45b3b72 commit a39f4a5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
11 changes: 5 additions & 6 deletions R/CM.R
Original file line number Diff line number Diff line change
@@ -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"---(
Expand Down Expand Up @@ -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"))
}
}

Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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]]),
Expand Down
12 changes: 9 additions & 3 deletions R/check_call_auto.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit a39f4a5

Please sign in to comment.