Skip to content

Commit

Permalink
feat: adds assertion to exported functions
Browse files Browse the repository at this point in the history
  • Loading branch information
averissimo committed Nov 30, 2023
1 parent a6d565c commit f50346b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions R/messages.R
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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(
Expand Down
2 changes: 2 additions & 0 deletions R/utils-xportr.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 ----
Expand Down

0 comments on commit f50346b

Please sign in to comment.