From dc9f82be52cbccf108af3664edbfbb2a4de11783 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Fri, 25 Oct 2024 08:53:50 +0100 Subject: [PATCH 1/9] Allow non-standard datanames in filter data (#622) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Pull Request Fixes https://github.com/insightsengineering/teal/issues/1366 Related: - https://github.com/insightsengineering/teal/pull/1382 - https://github.com/insightsengineering/teal.slice/pull/622 - https://github.com/insightsengineering/teal.data/pull/340 ### Changes description - Removed assertion on datanames that start with alphabetic character - [x] Fix problem with JS namespace in filter panel - [x] Fix crash when filtering using MAE (both SE and Matrix) - [x ] ~Fix upload of snapshot file that is not compatible~ - [x] Ignore datanames that contain functions, language, expression (and other non-data objects) - https://github.com/insightsengineering/teal/issues/1352 --------- Signed-off-by: André Veríssimo <211358+averissimo@users.noreply.github.com> Co-authored-by: Dawid Kałędkowski --- DESCRIPTION | 1 + R/FilterStates.R | 13 +- R/FilterStatesMatrix.R | 5 + R/FilterStatesSE.R | 4 +- R/FilteredData.R | 3 - R/FilteredDataset.R | 2 +- R/utils.R | 78 ++++++++---- man/check_simple_name.Rd | 21 ---- man/sanitize_id.Rd | 23 ++++ .../testthat/test-DataframeFilteredDataset.R | 4 +- tests/testthat/test-utils.R | 111 ++++++++++++++---- 11 files changed, 191 insertions(+), 74 deletions(-) delete mode 100644 man/check_simple_name.Rd create mode 100644 man/sanitize_id.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 81a89c49e..72ad39930 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -45,6 +45,7 @@ Imports: methods, plotly (>= 4.9.2.2), R6 (>= 2.2.0), + rlang (>= 1.0.0), shiny (>= 1.6.0), shinycssloaders (>= 1.0.0), shinyjs, diff --git a/R/FilterStates.R b/R/FilterStates.R index 4fceca00d..5ac79756e 100644 --- a/R/FilterStates.R +++ b/R/FilterStates.R @@ -57,7 +57,11 @@ FilterStates <- R6::R6Class( # nolint private$dataname <- dataname private$datalabel <- datalabel - private$dataname_prefixed <- dataname + private$dataname_prefixed <- if (identical(dataname, make.names(dataname))) { + dataname + } else { + sprintf("`%s`", dataname) + } private$data <- data private$data_reactive <- data_reactive private$state_list <- reactiveVal() @@ -165,7 +169,12 @@ FilterStates <- R6::R6Class( # nolint ) if (length(filter_items) > 0L) { filter_function <- private$fun - data_name <- str2lang(private$dataname_prefixed) + data_name <- tryCatch( + { + str2lang(private$dataname_prefixed) + }, + error = function(e) str2lang(paste0("`", private$dataname_prefixed, "`")) + ) substitute( env = list( lhs = data_name, diff --git a/R/FilterStatesMatrix.R b/R/FilterStatesMatrix.R index 776c1bbc9..d5ed4d136 100644 --- a/R/FilterStatesMatrix.R +++ b/R/FilterStatesMatrix.R @@ -35,6 +35,11 @@ MatrixFilterStates <- R6::R6Class( # nolint checkmate::assert_matrix(data) super$initialize(data, data_reactive, dataname, datalabel) private$set_filterable_varnames(include_varnames = colnames(private$data)) + if (!is.null(datalabel)) { + private$dataname_prefixed <- sprintf( + "%s[['%s']]", private$dataname_prefixed, datalabel + ) + } } ), private = list( diff --git a/R/FilterStatesSE.R b/R/FilterStatesSE.R index 686bb44c4..06e14eac1 100644 --- a/R/FilterStatesSE.R +++ b/R/FilterStatesSE.R @@ -39,7 +39,9 @@ SEFilterStates <- R6::R6Class( # nolint checkmate::assert_class(data, "SummarizedExperiment") super$initialize(data, data_reactive, dataname, datalabel) if (!is.null(datalabel)) { - private$dataname_prefixed <- sprintf("%s[['%s']]", dataname, datalabel) + private$dataname_prefixed <- sprintf( + "%s[['%s']]", private$dataname_prefixed, datalabel + ) } }, 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..2ffefe420 100644 --- a/R/FilteredDataset.R +++ b/R/FilteredDataset.R @@ -30,7 +30,7 @@ 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) + checkmate::assert_string(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..caceb09c5 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 @@ -81,3 +56,56 @@ make_c_call <- function(choices) { if (length(private$session_bindings) > 0) lapply(private$session_bindings, function(x) x$destroy()) invisible(NULL) } + + + +#' Encodes ids to be used in JavaScript and Shiny +#' +#' @description +#' Replaces non-ASCII characters into a format that can be used in HTML, +#' JavaScript and Shiny. +#' +#' When the id has a character that is not allowed, it is replaced with `"_"` +#' and a 4 character hash of the original id is added to the start of the +#' resulting id. +#' +#' +#' @param id (`character(1)`) The id string. +#' +#' @return Sanitized string that removes special characters and spaces. +#' +#' @keywords internal +sanitize_id <- function(id) { + pattern_escape <- "[^0-9A-Za-z_]" + + id_new <- gsub(pattern_escape, "_", id) + hashes <- vapply(id[id != id_new], rlang::hash, character(1), USE.NAMES = FALSE) + + id[id != id_new] <- paste0("h", substr(hashes, 1, 4), "_", id_new[id != id_new]) + id +} + +#' `NS` wrapper to sanitize ids for shiny +#' +#' Special characters and spaces are not allowed in shiny ids (in JS) +#' +#' @noRd +NS <- function(namespace, id = NULL) { # nolint: object_name. + if (!missing(id)) { + return(shiny::NS(namespace, sanitize_id(id))) + } + + function(id) { + shiny::NS(namespace, sanitize_id(id)) + } +} + +#' `moduleServer` wrapper to sanitize ids for shiny +#' +#' Special characters and spaces are not allowed in shiny ids (in JS) +#' +#' @noRd +moduleServer <- function(id, module, session = getDefaultReactiveDomain()) { # nolint: object_name. + id <- sanitize_id(id) + shiny::moduleServer(id, module, session) +} 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} diff --git a/man/sanitize_id.Rd b/man/sanitize_id.Rd new file mode 100644 index 000000000..7a67ebd69 --- /dev/null +++ b/man/sanitize_id.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/utils.R +\name{sanitize_id} +\alias{sanitize_id} +\title{Encodes ids to be used in JavaScript and Shiny} +\usage{ +sanitize_id(id) +} +\arguments{ +\item{id}{(\code{character(1)}) The id string.} +} +\value{ +Sanitized string that removes special characters and spaces. +} +\description{ +Replaces non-ASCII characters into a format that can be used in HTML, +JavaScript and Shiny. + +When the id has a character that is not allowed, it is replaced with \code{"_"} +and a 4 character hash of the original id is added to the start of the +resulting id. +} +\keyword{internal} diff --git a/tests/testthat/test-DataframeFilteredDataset.R b/tests/testthat/test-DataframeFilteredDataset.R index 7ab9f8b65..d90987aa9 100644 --- a/tests/testthat/test-DataframeFilteredDataset.R +++ b/tests/testthat/test-DataframeFilteredDataset.R @@ -4,7 +4,9 @@ testthat::test_that("constructor accepts data.frame object with a dataname", { testthat::expect_error(DataframeFilteredDataset$new(dataset = head(iris)), "argument .+ missing, with no default") testthat::expect_error(DataframeFilteredDataset$new(dataname = "iris"), "argument .+ missing, with no default") testthat::expect_error(DataframeFilteredDataset$new(dataset = as.list(iris)), "Assertion on 'dataset' failed") - testthat::expect_error(DataframeFilteredDataset$new(dataset = iris, dataname = iris), "Assertion on 'name' failed") + testthat::expect_error( + DataframeFilteredDataset$new(dataset = iris, dataname = iris), "Assertion on 'dataname' failed" + ) }) testthat::test_that("filter_states list is initialized with single `FilterStates` element named filter", { diff --git a/tests/testthat/test-utils.R b/tests/testthat/test-utils.R index 91cb3a6aa..6d9d542fd 100644 --- a/tests/testthat/test-utils.R +++ b/tests/testthat/test-utils.R @@ -1,25 +1,96 @@ -# check_simple_name ---- -test_that("check_simple_name behaves as expected", { - testthat::expect_silent(check_simple_name("aas2df")) - testthat::expect_silent(check_simple_name("ADSL")) - testthat::expect_silent(check_simple_name("ADSLmodified")) - testthat::expect_silent(check_simple_name("a1")) - testthat::expect_silent(check_simple_name("ADSL_modified")) - testthat::expect_silent(check_simple_name("ADSL_filtered")) - testthat::expect_silent(check_simple_name("FILTERED_ADSL")) - testthat::expect_silent(check_simple_name("FILTERED")) - testthat::expect_silent(check_simple_name("ADSLFILTERED")) - testthat::expect_silent(check_simple_name("a_1_2_b_")) - - testthat::expect_error(check_simple_name("1a"), "name '.+' must only contain alphanumeric characters") - testthat::expect_error(check_simple_name("ADSL.modified"), "name '.+' must only contain alphanumeric characters") - testthat::expect_error(check_simple_name("a1..."), "name '.+' must only contain alphanumeric characters") - testthat::expect_error(check_simple_name("a a"), "name '.+' must only contain alphanumeric characters") - testthat::expect_error(check_simple_name("_A_b"), "name '.+' must only contain alphanumeric characters") -}) - # make_c_call ---- testthat::test_that("make_c_call", { testthat::expect_identical(make_c_call(1:3), quote(c(1L, 2L, 3L))) testthat::expect_identical(make_c_call(1), 1) }) + +# sanitize_id ---- +testthat::describe("sanitize_id", { + testthat::it("should replace dots with `_` when id is otherwise valid", { + id <- "a.b" + ns <- teal.slice:::NS("app") + testthat::expect_identical( + ns(id), + paste0("app-h", substr(rlang::hash(id), 1, 4), "_a_b") + ) + }) + + testthat::it("should take vector input", { + id <- c("a.b", "a", "b", " c") + ns <- teal.slice:::NS("app") + testthat::expect_identical( + ns(id), + c( + paste0("app-h", substr(rlang::hash(id[1]), 1, 4), "_a_b"), + "app-a", + "app-b", + paste0("app-h", substr(rlang::hash(id[4]), 1, 4), "__c") + ) + ) + }) + + testthat::it("should allow for integer input", { + id <- c(1L, 2L, 3L) + ns <- teal.slice:::NS("app") + testthat::expect_identical( + ns(id), + c("app-1", "app-2", "app-3") + ) + }) + + testthat::it("should replace non-ASCII characters in middle of id with `_`", { + id <- "a$b" + ns <- teal.slice:::NS("app") + testthat::expect_identical( + ns(id), + paste0("app-h", substr(rlang::hash(id), 1, 4), "_a_b") + ) + }) + + # Test using moduleServer to access the sanitized id + testthat::it("should replace non-ASCII characters in the start/end of id with `_`", { + id <- "%a bad symbol$" + id2 <- "a&b#" + id_from_module <- shiny::withReactiveDomain( + MockShinySession$new(), + teal.slice:::moduleServer(id, function(input, output, session) session$ns("a_good_name")) + ) + + testthat::expect_identical( + id_from_module, + paste0("h", substr(rlang::hash(id), 1, 4), "__a_bad_symbol_-a_good_name") + ) + }) + + testthat::it("should replace all quotes characters with `_`", { + id <- " a.b.c\"d`e'j" + testthat::expect_identical( + teal.slice:::NS("app", id), + paste0("app-h", substr(rlang::hash(id), 1, 4), "__a_b_c_d_e_j") + ) + }) + + testthat::it("should replace all escape characters from JQuery selectors", { + forbidden <- " !\"#$%&'()*+,./:;<=>?@[\\]^`{|}~]" + testthat::expect_identical( + teal.slice:::NS("app", forbidden), + paste0( + "app-h", + substr(rlang::hash(forbidden), 1, 4), + paste(rep("_", nchar(forbidden) + 1), collapse = "") + ) + ) + }) + + testthat::it("should replace UTF characters outside the allowed range", { + id <- "\U41\U05E\U30\U5F\U7A\U1F4AA" # "A:circumflex_accent:0_z:flexed_biceps: + testthat::expect_identical( + teal.slice:::NS("app", id), + paste0( + "app-h", + substr(rlang::hash(id), 1, 4), + "_A_0_z_" + ) + ) + }) +}) From c9cede08330d87ba9156ba28204542c15b70e4bc Mon Sep 17 00:00:00 2001 From: averissimo Date: Fri, 25 Oct 2024 07:55:02 +0000 Subject: [PATCH 2/9] [skip actions] Bump version to 0.5.1.9013 --- .pre-commit-config.yaml | 2 +- DESCRIPTION | 4 ++-- NEWS.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 69e978ae5..6bed6a537 100755 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ --- # All available hooks: https://pre-commit.com/hooks.html # R specific hooks: https://github.com/lorenzwalthert/precommit -default_stages: [commit] +default_stages: [pre-commit] default_language_version: python: python3 repos: diff --git a/DESCRIPTION b/DESCRIPTION index 72ad39930..f956b2e92 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: teal.slice Title: Filter Module for 'teal' Applications -Version: 0.5.1.9012 -Date: 2024-09-16 +Version: 0.5.1.9013 +Date: 2024-10-25 Authors@R: c( person("Dawid", "Kaledkowski", , "dawid.kaledkowski@roche.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-9533-457X")), diff --git a/NEWS.md b/NEWS.md index b493de05e..6e5f5577f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# teal.slice 0.5.1.9012 +# teal.slice 0.5.1.9013 ### Enhancements From 912a28133c3556b3daea8c7d591666f9be2aaf72 Mon Sep 17 00:00:00 2001 From: Pawel Rucki <12943682+pawelru@users.noreply.github.com> Date: Fri, 25 Oct 2024 12:26:04 +0200 Subject: [PATCH 3/9] add rmarkdown to VignetteBuilder (#626) fix nosuggests ci --- DESCRIPTION | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index f956b2e92..b326b8702 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -62,7 +62,8 @@ Suggests: testthat (>= 3.1.5), withr (>= 2.1.0) VignetteBuilder: - knitr + knitr, + rmarkdown RdMacros: lifecycle Config/Needs/verdepcheck: rstudio/shiny, rstudio/bslib, mllg/checkmate, From e07256a0d14e06b6556dc28a221ded65c2e55efc Mon Sep 17 00:00:00 2001 From: pawelru Date: Fri, 25 Oct 2024 10:27:14 +0000 Subject: [PATCH 4/9] [skip actions] Bump version to 0.5.1.9014 --- DESCRIPTION | 2 +- NEWS.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index b326b8702..3a10b2f11 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: teal.slice Title: Filter Module for 'teal' Applications -Version: 0.5.1.9013 +Version: 0.5.1.9014 Date: 2024-10-25 Authors@R: c( person("Dawid", "Kaledkowski", , "dawid.kaledkowski@roche.com", role = c("aut", "cre"), diff --git a/NEWS.md b/NEWS.md index 6e5f5577f..65b8459a5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# teal.slice 0.5.1.9013 +# teal.slice 0.5.1.9014 ### Enhancements From b732c15e22c43291f2e83ac8f4c409ed66f9008c Mon Sep 17 00:00:00 2001 From: Dony Unardi Date: Fri, 1 Nov 2024 12:58:44 -0700 Subject: [PATCH 5/9] update min version of testthat and precommit config (#627) Similar with https://github.com/insightsengineering/teal.code/pull/220, failure in min_isolated pipeline: https://github.com/insightsengineering/teal.slice/actions/runs/11537362432/job/32114685586#step:9:1346 ### Summary: * Update testthat minimum version due to usage of `testthat::it()` in DESCRIPTION file: https://github.com/insightsengineering/teal.slice/blob/main/tests/testthat/test-utils.R#L9 * Add `teal.code` to the pre-commit configuration to allow it to use the development version when running. This is necessary because the development version of `teal.data` requires the development version of `teal.code` to run, and without this, the pre-commit will fail. --- .pre-commit-config.yaml | 1 + DESCRIPTION | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6bed6a537..225106070 100755 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,6 +30,7 @@ repos: - shinycssloaders - shinyjs - shinyWidgets + - insightsengineering/teal.code - insightsengineering/teal.data - insightsengineering/teal.logger - insightsengineering/teal.widgets diff --git a/DESCRIPTION b/DESCRIPTION index 3a10b2f11..1abcbb34d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -59,7 +59,7 @@ Suggests: MultiAssayExperiment, rmarkdown (>= 2.23), SummarizedExperiment, - testthat (>= 3.1.5), + testthat (>= 3.1.8), withr (>= 2.1.0) VignetteBuilder: knitr, From 25f41015bc1ed8b9c5301b8cf1ae48cbf7c96f2c Mon Sep 17 00:00:00 2001 From: donyunardi Date: Fri, 1 Nov 2024 19:59:56 +0000 Subject: [PATCH 6/9] [skip actions] Bump version to 0.5.1.9015 --- DESCRIPTION | 4 ++-- NEWS.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 1abcbb34d..1316dbe75 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: teal.slice Title: Filter Module for 'teal' Applications -Version: 0.5.1.9014 -Date: 2024-10-25 +Version: 0.5.1.9015 +Date: 2024-11-01 Authors@R: c( person("Dawid", "Kaledkowski", , "dawid.kaledkowski@roche.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-9533-457X")), diff --git a/NEWS.md b/NEWS.md index 65b8459a5..fe06e0865 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# teal.slice 0.5.1.9014 +# teal.slice 0.5.1.9015 ### Enhancements From a3d9a0f10000a484a534dc1d84184d573a8a21a8 Mon Sep 17 00:00:00 2001 From: Pawel Rucki <12943682+pawelru@users.noreply.github.com> Date: Mon, 4 Nov 2024 15:49:01 +0100 Subject: [PATCH 7/9] Update scheduled.yaml (#628) Currently the max strategy fails with the following: ``` Error : ! Could not solve package dependencies: * deps::/tmp/RtmpZGFxMH/filec219ed9d76: Can't install dependency insightsengineering/teal.data * insightsengineering/teal.data: Can't install dependency teal.code (>= 0.5.0.9011) ``` `teal.code` is an indirect dependency via `teal.data` Signed-off-by: Pawel Rucki <12943682+pawelru@users.noreply.github.com> --- .github/workflows/scheduled.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/scheduled.yaml b/.github/workflows/scheduled.yaml index f82c4c325..3c621eb25 100644 --- a/.github/workflows/scheduled.yaml +++ b/.github/workflows/scheduled.yaml @@ -38,6 +38,8 @@ jobs: strategy: ${{ matrix.test-strategy }} additional-env-vars: | PKG_SYSREQS_DRY_RUN=true + extra-deps: | + insightsengineering/teal.code branch-cleanup: if: > github.event_name == 'schedule' || ( From 2c60f56c1b9143d3d10f961ca4ad6070c9b0471e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Revilla?= <185338939+llrs-roche@users.noreply.github.com> Date: Thu, 14 Nov 2024 16:15:57 +0100 Subject: [PATCH 8/9] Remove arguments (#630) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Pull Request Fixes #623 After 1 year with an error and with `verify()` in place, it makes sense to remove them. I didn't keep any documentation or redirect users to other functions/examples, (but it is hard for me to guess if users might not know how to update their code). The checks will fail due to #629 --------- Signed-off-by: Lluís Revilla <185338939+llrs-roche@users.noreply.github.com> Co-authored-by: Marcin <133694481+m7pr@users.noreply.github.com> --- NEWS.md | 1 + R/FilteredData-utils.R | 16 +--------------- man/init_filtered_data.Rd | 6 +----- 3 files changed, 3 insertions(+), 20 deletions(-) diff --git a/NEWS.md b/NEWS.md index fe06e0865..ad2375b70 100644 --- a/NEWS.md +++ b/NEWS.md @@ -3,6 +3,7 @@ ### Enhancements * Reduced the space of the filter panel by not displaying the "add filters" UI in a separate panel. +* The deprecated parameters `code` and `check` were removed from `init_filtered_data()`. ### Bug fixes diff --git a/R/FilteredData-utils.R b/R/FilteredData-utils.R index 6f2e272a3..69df4a96b 100644 --- a/R/FilteredData-utils.R +++ b/R/FilteredData-utils.R @@ -4,8 +4,6 @@ #' #' @param x (`named list`) of datasets. #' @param join_keys (`join_keys`) see [`teal.data::join_keys()`]. -#' @param code `r lifecycle::badge("deprecated")` -#' @param check `r lifecycle::badge("deprecated")` #' #' @return Object of class `FilteredData`. #' @@ -14,21 +12,9 @@ #' datasets #' #' @export -init_filtered_data <- function(x, join_keys = teal.data::join_keys(), code, check) { # nolint +init_filtered_data <- function(x, join_keys = teal.data::join_keys()) { # nolint checkmate::assert_list(x, any.missing = FALSE, names = "unique") checkmate::assert_class(join_keys, "join_keys") - if (!missing(code)) { - lifecycle::deprecate_stop( - "0.5.0", - "init_filtered_data(code = 'No longer supported')" - ) - } - if (!missing(check)) { - lifecycle::deprecate_stop( - "0.5.0", - "init_filtered_data(check = 'No longer supported')" - ) - } FilteredData$new(x, join_keys = join_keys) } diff --git a/man/init_filtered_data.Rd b/man/init_filtered_data.Rd index 6994400bf..d07fc8097 100644 --- a/man/init_filtered_data.Rd +++ b/man/init_filtered_data.Rd @@ -4,16 +4,12 @@ \alias{init_filtered_data} \title{Initialize \code{FilteredData}} \usage{ -init_filtered_data(x, join_keys = teal.data::join_keys(), code, check) +init_filtered_data(x, join_keys = teal.data::join_keys()) } \arguments{ \item{x}{(\verb{named list}) of datasets.} \item{join_keys}{(\code{join_keys}) see \code{\link[teal.data:join_keys]{teal.data::join_keys()}}.} - -\item{code}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}}} - -\item{check}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}}} } \value{ Object of class \code{FilteredData}. From 1ba57bade101e0a0f641d11e033849ad303af443 Mon Sep 17 00:00:00 2001 From: llrs-roche Date: Thu, 14 Nov 2024 15:17:09 +0000 Subject: [PATCH 9/9] [skip actions] Bump version to 0.5.1.9016 --- .pre-commit-config.yaml | 2 +- DESCRIPTION | 4 ++-- NEWS.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 225106070..8743d1e1b 100755 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ default_language_version: python: python3 repos: - repo: https://github.com/lorenzwalthert/precommit - rev: v0.4.3.9001 + rev: v0.4.3.9003 hooks: - id: style-files name: Style code with `styler` diff --git a/DESCRIPTION b/DESCRIPTION index 1316dbe75..24231c2fb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: teal.slice Title: Filter Module for 'teal' Applications -Version: 0.5.1.9015 -Date: 2024-11-01 +Version: 0.5.1.9016 +Date: 2024-11-14 Authors@R: c( person("Dawid", "Kaledkowski", , "dawid.kaledkowski@roche.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-9533-457X")), diff --git a/NEWS.md b/NEWS.md index ad2375b70..99ea81db1 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# teal.slice 0.5.1.9015 +# teal.slice 0.5.1.9016 ### Enhancements