Skip to content

Commit

Permalink
add a check for non-unique decorator names (#828)
Browse files Browse the repository at this point in the history
The same as in tmc

insightsengineering/teal.modules.clinical@b048f37
do not allow decorators with duplicated names

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
m7pr and github-actions[bot] authored Jan 22, 2025
1 parent 572f7b8 commit d01a47f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,14 @@ check_decorators <- function(x, names = NULL) { # nolint: object_name.
check_message <- if (isTRUE(check_message)) {
out_message <- checkmate::check_names(names(x), subset.of = c("default", names))
# see https://github.com/insightsengineering/teal.logger/issues/101
if (length(names(x)) != length(unique(names(x)))) {
unique_message <- "Non-unique names in decorators"
if (isTRUE(out_message)) {
out_message <- unique_message
} else {
out_message <- paste0(out_message, ". Also, ", tolower(unique_message))
}
}
if (isTRUE(out_message)) {
out_message
} else {
Expand Down

0 comments on commit d01a47f

Please sign in to comment.