Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use deparse instead of deparse1 #237

Merged
merged 4 commits into from
Jun 1, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions R/input-check-helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,19 @@ check_true_values <- function(true_values,
#' @param ... The variables to check
#' @return The function returns `NULL`, but throws an error if the variable is
#' missing.
#' @example
#' test_function <- function(argument = NULL) {
#' scoringutils:::check_not_null("argument" = argument)
#' paste("Input:", argument)
#' }
#' test_function("works")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CRAN doesn't like examples on non-exported functions. Even though it might pass under their radar, it's probably safer to add a #' @noRd somewhere.

#'
#' @keywords internal
check_not_null <- function(...) {
vars <- list(...)
varnames <- names(vars)

calling_function <- deparse1(sys.calls()[[sys.nframe() - 1]])
calling_function <- deparse(sys.calls()[[sys.nframe() - 1]])

for (i in seq_along(vars)) {
varname <- varnames[i]
Expand Down Expand Up @@ -165,7 +171,7 @@ check_equal_length <- function(...,
}

if (length(unique(lengths)) != 1) {
calling_function <- deparse1(sys.calls()[[sys.nframe() - 1]])
calling_function <- deparse(sys.calls()[[sys.nframe() - 1]])
stop(paste0(
"Arguments passed to the following function call: '",
calling_function,
Expand Down