From f50346b68d69a408878d457b23643831f3347990 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Thu, 23 Nov 2023 19:24:51 +0100 Subject: [PATCH] feat: adds assertion to exported functions --- R/messages.R | 6 ++++++ R/utils-xportr.R | 2 ++ 2 files changed, 8 insertions(+) diff --git a/R/messages.R b/R/messages.R index 0c56784c..429388f8 100644 --- a/R/messages.R +++ b/R/messages.R @@ -10,6 +10,9 @@ #' @return Output to Console #' @export xportr_logger <- function(message, type = "none", ...) { + assert_character(message) + assert_choice(verbose, choices = .internal_verbose_choices) + log_fun <- switch(type, stop = abort, warn = warn, @@ -28,6 +31,9 @@ xportr_logger <- function(message, type = "none", ...) { #' @return Output to Console #' @export var_names_log <- function(tidy_names_df, verbose) { + assert_data_frame(tidy_names_df) + assert_choice(verbose, choices = .internal_verbose_choices) + only_renames <- tidy_names_df %>% filter(original_varname != renamed_var) %>% mutate( diff --git a/R/utils-xportr.R b/R/utils-xportr.R index bb490ec5..0ef807fb 100644 --- a/R/utils-xportr.R +++ b/R/utils-xportr.R @@ -184,6 +184,8 @@ xpt_validate_var_names <- function(varnames, #' #' @export xpt_validate <- function(data) { + assert_data_frame(data) + err_cnd <- character() # 1.0 VARIABLES ----