From 12014f310aa3b64fb53bbca3900c834703c3bba3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 28 Oct 2024 10:15:32 +0000 Subject: [PATCH] Style code (GHA) --- R/process-plate.R | 12 ++++++++---- tests/testthat/test-generate_report.R | 3 +-- tests/testthat/test-helpers.R | 12 ++++++++---- tests/testthat/test-process-plate.R | 4 ++-- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/R/process-plate.R b/R/process-plate.R index 544f72d6..8bcd6f4e 100644 --- a/R/process-plate.R +++ b/R/process-plate.R @@ -75,8 +75,10 @@ is_valid_normalisation_type <- function(normalisation_type) { #' process_plate(plate, output_dir = example_dir) #' #' # process plate without adjusting blanks and save the output to a file with a custom name -#' process_plate(plate, filename = "plate_without_blanks_adjusted.csv", -#' output_dir = example_dir, adjust_blanks = FALSE) +#' process_plate(plate, +#' filename = "plate_without_blanks_adjusted.csv", +#' output_dir = example_dir, adjust_blanks = FALSE +#' ) #' #' #' # nMFI normalisation @@ -105,8 +107,10 @@ process_plate <- output_path <- validate_filepath_and_output_dir(filename, output_dir, - plate$plate_name, normalisation_type, - "csv", verbose = verbose) + plate$plate_name, normalisation_type, + "csv", + verbose = verbose + ) if (!plate$blank_adjusted && adjust_blanks) { diff --git a/tests/testthat/test-generate_report.R b/tests/testthat/test-generate_report.R index 600c7ef5..0b5c4f8a 100644 --- a/tests/testthat/test-generate_report.R +++ b/tests/testthat/test-generate_report.R @@ -33,7 +33,7 @@ test_that("Test generate_plate_report function", { expect_no_error(generate_plate_report(plate, output_dir = tmp_dir)) expect_no_error(generate_plate_report(plate, output_dir = tmp_dir, filename = "test_report.html")) file.remove(file.path(tmp_dir, "test_report.html")) - expect_no_error(generate_plate_report(plate, output_dir = tmp_dir, filename = "test_report.html", counts_lower_threshold = 40, counts_higher_threshold = 80)) + expect_no_error(generate_plate_report(plate, output_dir = tmp_dir, filename = "test_report.html", counts_lower_threshold = 40, counts_higher_threshold = 80)) file.remove(file.path(tmp_dir, "test_report.html")) expect_no_error(generate_plate_report(plate, output_dir = tmp_dir, filename = "test_report.html", additional_notes = "This is a test report.")) file.remove(file.path(tmp_dir, "test_report.html")) @@ -42,7 +42,6 @@ test_that("Test generate_plate_report function", { multiline_note <- "This is a test report.\nThis is a test report." expect_no_error(generate_plate_report(plate, output_dir = tmp_dir, filename = "test_report.html", additional_notes = multiline_note)) file.remove(file.path(tmp_dir, "test_report.html")) - }) test_that("Test generate_levey_jennings_report function", { diff --git a/tests/testthat/test-helpers.R b/tests/testthat/test-helpers.R index 3a2baf91..1cad9154 100644 --- a/tests/testthat/test-helpers.R +++ b/tests/testthat/test-helpers.R @@ -133,19 +133,23 @@ test_that("Test validate_filepath_and_output_dir function", { # filename with no output_dir expect_warning( - validate_filepath_and_output_dir(file.path(tmp_dir, "test.html"), tmp_dir, "plate_name", "report", "html")) + validate_filepath_and_output_dir(file.path(tmp_dir, "test.html"), tmp_dir, "plate_name", "report", "html") + ) expect_no_warning( - validate_filepath_and_output_dir(file.path(tmp_dir, "test.html"), NULL, "plate_name", "report", "html")) + validate_filepath_and_output_dir(file.path(tmp_dir, "test.html"), NULL, "plate_name", "report", "html") + ) file.create(file.path(tmp_dir, "test.html")) # overwrite existing file expect_warning( - validate_filepath_and_output_dir(file.path(tmp_dir, "test.html"), tmp_dir, "plate_name", "report", "html")) + validate_filepath_and_output_dir(file.path(tmp_dir, "test.html"), tmp_dir, "plate_name", "report", "html") + ) # create output directory expect_no_error( - validate_filepath_and_output_dir("test.html", file.path(tmp_dir, "output"), "plate_name", "report", "html")) + validate_filepath_and_output_dir("test.html", file.path(tmp_dir, "output"), "plate_name", "report", "html") + ) expect_true(dir.exists(file.path(tmp_dir, "output"))) }) diff --git a/tests/testthat/test-process-plate.R b/tests/testthat/test-process-plate.R index 56ea22a4..dec84793 100644 --- a/tests/testthat/test-process-plate.R +++ b/tests/testthat/test-process-plate.R @@ -46,7 +46,7 @@ test_that("Processing plate with nMFI", { file.remove(test_output_path) # Test processing of a plate with reference dilution specified expect_no_error( - process_plate(plate, output_dir = tmp_dir, filename = "output.csv", normalisation_type = "nMFI", reference_dilution = "1/50") + process_plate(plate, output_dir = tmp_dir, filename = "output.csv", normalisation_type = "nMFI", reference_dilution = "1/50") ) expect_true(file.exists(test_output_path)) expect_no_error(dilutions <- read.csv(test_output_path)) @@ -85,7 +85,7 @@ test_that("raw MFI in dataframe", { # Test processing of a plate, with raw MFI expect_no_error( - output_df <- process_plate(plate, output_dir = tmp_dir, filename = "output.csv", normalisation_type = "nMFI", include_raw_mfi = TRUE) + output_df <- process_plate(plate, output_dir = tmp_dir, filename = "output.csv", normalisation_type = "nMFI", include_raw_mfi = TRUE) ) stopifnot(all(colnames(output_df) == c(plate$analyte_names, paste0(plate$analyte_names, "_raw")))) })