Skip to content

Commit 95ea492

Browse files
gogonzollrs-rochegithub-actions[bot]averissimo
authored
Fix deep tests (#429)
Install teal.slice as important fix has been merged recently (insightsengineering/teal.slice#663). Please remember to install teal.slice locally if you want to test this branch - shinytest2 is run in the separate session so every packages must be installed (load_all has no effect). In this PR: - needed to replace hardcoded ids of filter panel inputs with a functional approach `!!ns_fs(<input path>) := <input value> `. Thanks to this we just need to change "id" in one place if we ever change the namespace in teal or teal.slice --------- Co-authored-by: Lluís Revilla <[email protected]> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: André Veríssimo <[email protected]> Co-authored-by: Lluís Revilla <[email protected]>
1 parent bab6fd1 commit 95ea492

37 files changed

+103
-130
lines changed

.lintr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
linters: linters_with_defaults(
22
line_length_linter = line_length_linter(120),
3-
cyclocomp_linter = NULL,
3+
pipe_consistency_linter = NULL,
44
object_usage_linter = NULL
55
)

R/adtteSpec.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ h_km_mae_to_adtte <- function(adtte,
101101
#' @return The UI part.
102102
#' @seealso [adtteSpecServer()] for the module server and a complete example.
103103
#' @export
104-
adtteSpecInput <- function(inputId, # nolint
104+
adtteSpecInput <- function(inputId, # nolint: object_name_linter.
105105
label_paramcd = "Select Endpoint") {
106106
assert_string(inputId)
107107
assert_string(label_paramcd, min.chars = 1L)
@@ -240,7 +240,7 @@ adtteSpecInput <- function(inputId, # nolint
240240
#' if (interactive()) {
241241
#' my_app()
242242
#' }
243-
adtteSpecServer <- function(id, # nolint
243+
adtteSpecServer <- function(id, # nolint: object_name_linter.
244244
data,
245245
mae_name,
246246
adtte_name,

R/assaySpec.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#' @return The UI part.
1111
#' @seealso [assaySpecServer()] for the module server and a complete example.
1212
#' @export
13-
assaySpecInput <- function(inputId, # nolint
13+
assaySpecInput <- function(inputId, # nolint: object_name_linter.
1414
label_assays = "Select Assay") {
1515
assert_string(inputId)
1616
assert_string(label_assays, min.chars = 1L)
@@ -97,7 +97,7 @@ assaySpecInput <- function(inputId, # nolint
9797
#' if (interactive()) {
9898
#' my_app()
9999
#' }
100-
assaySpecServer <- function(id, # nolint
100+
assaySpecServer <- function(id, # nolint: object_name_linter.
101101
assays,
102102
exclude_assays = character()) {
103103
assert_string(id)

R/checkmate.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ NULL
3737
#' @examples
3838
#' check_tag("bla")
3939
#' check_tag(NULL, null.ok = TRUE)
40-
check_tag <- function(x, null.ok = FALSE) { # nolint
40+
check_tag <- function(x, null.ok = FALSE) { # nolint: object_name_linter.
4141
assert_flag(null.ok)
4242
ok <- (null.ok && test_null(x)) || test_class(x, "shiny.tag") || test_class(x, "shiny.tag.list")
4343
if (!ok) {
4444
return("Must be a 'shiny.tag' or NULL")
4545
}
46-
return(TRUE)
46+
TRUE
4747
}
4848

4949
#' @rdname check_tag
@@ -106,7 +106,7 @@ test_reactive <- makeTestFunction(check_reactive)
106106
#'
107107
#' @examples
108108
#' assert_summary_funs(list(mean = colMeans, raw = NULL), null.ok = TRUE)
109-
assert_summary_funs <- function(x, null.ok = FALSE) { # nolint
109+
assert_summary_funs <- function(x, null.ok = FALSE) { # nolint: object_name_linter.
110110
assert_flag(null.ok)
111111
assert_list(
112112
x,

R/experimentSpec.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#' @return The UI part.
1111
#' @seealso [experimentSpecServer()] for the module server and a complete example.
1212
#' @export
13-
experimentSpecInput <- function(inputId, # nolint
13+
experimentSpecInput <- function(inputId, # nolint: object_name_linter.
1414
data,
1515
mae_name,
1616
label_experiments = "Select Experiment") {
@@ -205,7 +205,7 @@ h_gene_data <- function(object, name_annotation) {
205205
#' if (interactive()) {
206206
#' my_app()
207207
#' }
208-
experimentSpecServer <- function(id, # nolint
208+
experimentSpecServer <- function(id, # nolint: object_name_linter.
209209
data,
210210
filter_panel_api,
211211
mae_name,
@@ -277,7 +277,7 @@ experimentSpecServer <- function(id, # nolint
277277
data = data_return,
278278
name = reactive({
279279
input$name
280-
}), # nolint
280+
}),
281281
genes = genes,
282282
assays = assays
283283
)

R/geneSpec.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#'
2424
#' @examples
2525
#' geneSpecInput("my_genes", list(mean = colMeans), label_funs = "Please select function")
26-
geneSpecInput <- function(inputId, # nolint
26+
geneSpecInput <- function(inputId, # nolint: object_name_linter.
2727
funs,
2828
label_genes = "Select Gene(s)",
2929
label_funs = "Select Gene Summary",
@@ -148,7 +148,7 @@ geneSpecInput <- function(inputId, # nolint
148148
#'
149149
#' @export
150150
h_update_gene_selection <- function(session,
151-
inputId, # nolint
151+
inputId, # nolint: object_name_linter.
152152
selected,
153153
choices) {
154154
is_new_selected <- selected %in% choices$id
@@ -285,7 +285,7 @@ h_parse_genes <- function(words, choices) {
285285
#' if (interactive()) {
286286
#' my_app()
287287
#' }
288-
geneSpecServer <- function(id, # nolint
288+
geneSpecServer <- function(id, # nolint: object_name_linter.
289289
funs,
290290
gene_choices,
291291
label_modal_title = "Enter list of genes",
@@ -378,7 +378,7 @@ geneSpecServer <- function(id, # nolint
378378
})
379379

380380
# Return the UI for a modal dialog with gene text input, showing examples.
381-
dataModal <- function(example_list) { # nolint
381+
dataModal <- function(example_list) { # nolint: object_name_linter.
382382
modalDialog(
383383
textInput(
384384
session$ns("gene_text"),

R/sampleVarSpec.R

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#'
1515
#' @examples
1616
#' sampleVarSpecInput("my_vars", label_vars = "Select faceting variable")
17-
sampleVarSpecInput <- function(inputId, # nolint
17+
sampleVarSpecInput <- function(inputId, # nolint: object_name_linter.
1818
label_vars = "Select sample variable",
1919
label_levels_button = "Combine factor levels") {
2020
assert_string(inputId)
@@ -261,7 +261,7 @@ validate_n_levels <- function(x, name, n_levels) {
261261
#' if (interactive()) {
262262
#' my_app()
263263
#' }
264-
sampleVarSpecServer <- function(id, # nolint
264+
sampleVarSpecServer <- function(id, # nolint: object_name_linter.
265265
experiment_name,
266266
original_data,
267267
transformed_data = original_data,
@@ -366,7 +366,7 @@ sampleVarSpecServer <- function(id, # nolint
366366

367367
# Function to return the UI for a modal dialog with matrix input for combination
368368
# assignment.
369-
combModal <- function(sample_var_levels, # nolint
369+
combModal <- function(sample_var_levels, # nolint: object_name_linter.
370370
n_max_groups,
371371
selected_groups) {
372372
if (is.null(selected_groups)) {
@@ -416,9 +416,9 @@ sampleVarSpecServer <- function(id, # nolint
416416

417417
old_values <- names(assign_lists[[experiment_name]][[sample_var]])
418418
if (!is.null(old_values) &&
419-
length(old_values) == length(sample_var_levels) && # nolint
420-
all(sort(old_values) == sort(sample_var_levels))) { # nolint
421-
selected_groups <- assign_lists[[experiment_name]][[sample_var]] # nolint
419+
length(old_values) == length(sample_var_levels) && # nolint: indentation_linter.
420+
all(sort(old_values) == sort(sample_var_levels))) {
421+
selected_groups <- assign_lists[[experiment_name]][[sample_var]]
422422
}
423423

424424
showModal(combModal(
@@ -490,14 +490,14 @@ sampleVarSpecServer <- function(id, # nolint
490490
#' experiment_name = reactive({
491491
#' input$experiment_name
492492
#' }),
493-
#' original_data = ori_data # nolint Please update the <ori_data>
493+
#' original_data = ori_data # Please update the <ori_data>
494494
#' )
495495
#' # Then can extract the transformed data and selected variables later:
496496
#' experiment_data <- sample_var_specs$experiment_data()
497497
#' facet_var <- sample_var_specs$vars$facet_var()
498498
#' color_var <- sample_var_specs$vars$color_var()
499499
#' }
500-
multiSampleVarSpecServer <- function(inputIds, # nolint
500+
multiSampleVarSpecServer <- function(inputIds, # nolint: object_name_linter.
501501
original_data,
502502
...) {
503503
assert_character(inputIds, any.missing = FALSE, unique = TRUE)

R/tm_g_barplot.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ srv_g_barplot <- function(id,
272272
sample_tm_g_barplot <- function(.test = FALSE) {
273273
data <- within(
274274
teal.data::teal_data(),
275-
MAE <- hermes::multi_assay_experiment # nolint
275+
MAE <- hermes::multi_assay_experiment # nolint: object_name_linter.
276276
)
277277
app <- teal::init(
278278
data = data,

R/tm_g_boxplot.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ srv_g_boxplot <- function(id,
284284
sample_tm_g_boxplot <- function(.test = FALSE) {
285285
data <- within(
286286
teal.data::teal_data(),
287-
MAE <- hermes::multi_assay_experiment # nolint
287+
MAE <- hermes::multi_assay_experiment # nolint: object_name_linter.
288288
)
289289
app <- teal::init(
290290
data = data,

R/tm_g_forest_tte.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,11 +306,11 @@ srv_g_forest_tte <- function(id,
306306
#' if (interactive()) {
307307
#' sample_tm_g_forest_tte()
308308
#' }
309-
sample_tm_g_forest_tte <- function(.test = FALSE) { # nolint
309+
sample_tm_g_forest_tte <- function(.test = FALSE) {
310310
data <- within(teal.data::teal_data(), {
311-
ADTTE <- teal.data::rADTTE |> # nolint
311+
ADTTE <- teal.data::rADTTE |> # nolint: object_name_linter.
312312
dplyr::mutate(is_event = .data$CNSR == 0)
313-
MAE <- hermes::multi_assay_experiment # nolint
313+
MAE <- hermes::multi_assay_experiment # nolint: object_name_linter.
314314
})
315315
join_keys(data)["ADTTE", "ADTTE"] <- c("STUDYID", "USUBJID", "PARAMCD")
316316

0 commit comments

Comments
 (0)