From 507d3f94620947d3d199436ee5fca0357ac6afea 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 | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) 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 98668991..572f95bd 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 ---- @@ -310,8 +312,6 @@ xpt_validate <- function(data) { #' @return A string representing the domain #' @noRd get_domain <- function(.df, df_arg, domain) { - assert_string(domain, null.ok = TRUE) - if (identical(df_arg, ".")) { df_arg <- get_pipe_call() }