diff --git a/R/FilteredData.R b/R/FilteredData.R index 9b56ee937..c36227c80 100644 --- a/R/FilteredData.R +++ b/R/FilteredData.R @@ -307,9 +307,6 @@ FilteredData <- R6::R6Class( # nolint set_dataset = function(data, dataname) { checkmate::assert_string(dataname) logger::log_debug("FilteredData$set_dataset setting dataset, name: { dataname }") - # to include it nicely in the Show R Code; - # the UI also uses `datanames` in ids, so no whitespaces allowed - check_simple_name(dataname) parent_dataname <- teal.data::parent(private$join_keys, dataname) keys <- private$join_keys[dataname, dataname] diff --git a/R/FilteredDataset.R b/R/FilteredDataset.R index 998f5f4d8..830d3ed14 100644 --- a/R/FilteredDataset.R +++ b/R/FilteredDataset.R @@ -30,7 +30,6 @@ FilteredDataset <- R6::R6Class( # nolint #' @return Object of class `FilteredDataset`, invisibly. #' initialize = function(dataset, dataname, keys = character(0), label = attr(dataset, "label", exact = TRUE)) { - check_simple_name(dataname) logger::log_debug("Instantiating { class(self)[1] }, dataname: { dataname }") checkmate::assert_character(keys, any.missing = FALSE) checkmate::assert_character(label, null.ok = TRUE) diff --git a/R/utils.R b/R/utils.R index 725f5a8c9..862d7f729 100644 --- a/R/utils.R +++ b/R/utils.R @@ -1,28 +1,3 @@ -#' Test whether variable name can be used within `Show R Code` -#' -#' Variable names containing spaces are problematic and must be wrapped in backticks. -#' Also, they should not start with a number as `R` may silently make it valid by changing it. -#' Therefore, we only allow alphanumeric characters with underscores. -#' The first character of the `name` must be an alphabetic character and can be followed by alphanumeric characters. -#' -#' @md -#' -#' @param name (`character`) vector of names to check -#' @return Returns `NULL` or raises error. -#' @keywords internal -#' -check_simple_name <- function(name) { - checkmate::assert_character(name, min.len = 1, any.missing = FALSE) - if (!grepl("^[[:alpha:]][a-zA-Z0-9_]*$", name, perl = TRUE)) { - stop( - "name '", - name, - "' must only contain alphanumeric characters (with underscores)", - " and the first character must be an alphabetic character" - ) - } -} - #' Include `JS` files from `/inst/js/` package directory to application header #' #' `system.file` should not be used to access files in other packages, it does diff --git a/man/check_simple_name.Rd b/man/check_simple_name.Rd deleted file mode 100644 index b8472b5fb..000000000 --- a/man/check_simple_name.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utils.R -\name{check_simple_name} -\alias{check_simple_name} -\title{Test whether variable name can be used within \verb{Show R Code}} -\usage{ -check_simple_name(name) -} -\arguments{ -\item{name}{(\code{character}) vector of names to check} -} -\value{ -Returns \code{NULL} or raises error. -} -\description{ -Variable names containing spaces are problematic and must be wrapped in backticks. -Also, they should not start with a number as \code{R} may silently make it valid by changing it. -Therefore, we only allow alphanumeric characters with underscores. -The first character of the \code{name} must be an alphabetic character and can be followed by alphanumeric characters. -} -\keyword{internal}