diff --git a/.github/workflows/lint-project.yaml b/.github/workflows/lint-project.yaml index afe0884..d1bafde 100644 --- a/.github/workflows/lint-project.yaml +++ b/.github/workflows/lint-project.yaml @@ -22,7 +22,7 @@ jobs: use-public-rspm: true - name: Install lintr - run: install.packages("lintr") + run: install.packages(c("lintr", "cyclocomp")) shell: Rscript {0} - name: Lint root directory diff --git a/.lintr b/.lintr index 38ab730..8d12c5f 100644 --- a/.lintr +++ b/.lintr @@ -1,6 +1,7 @@ linters: linters_with_defaults( line_length_linter(120), commented_code_linter = NULL, - object_usage_linter = NULL + object_usage_linter = NULL, + cyclocomp_linter = cyclocomp_linter() ) diff --git a/R/eula.R b/R/eula.R index dfd998b..20425d1 100644 --- a/R/eula.R +++ b/R/eula.R @@ -86,5 +86,5 @@ auto_accepted_eula <- function() { value <- Sys.getenv(AUTO_ACCEPT_ENV_VAR, unset = "false") value <- trimws(tolower(value)) - return(value %in% c("t", "true", "y", "yes")) + value %in% c("t", "true", "y", "yes") } diff --git a/R/hdf5.R b/R/hdf5.R index 9a568d0..110df8b 100644 --- a/R/hdf5.R +++ b/R/hdf5.R @@ -67,7 +67,7 @@ write_mat <- function(f, count_mat, feature_ids) { if (is.null(feature_ids)) { feature_ids <- lapply(seq_along(features), function(x) { - return(sprintf("feature_%d", x)) + sprintf("feature_%d", x) }) } diff --git a/R/setup.R b/R/setup.R index eeb071f..9bc9bda 100644 --- a/R/setup.R +++ b/R/setup.R @@ -166,9 +166,9 @@ bundled_executable_path <- function() { executable_basename <- function() { if (get_system_os() == "windows") { - return("louper.exe") + "louper.exe" } else { - return("louper") + "louper" } } @@ -195,10 +195,10 @@ get_artifact <- function() { os <- get_system_os() if (os == "windows") { - return(artifacts$windows) + artifacts$windows } else if (os == "mac") { - return(artifacts$mac) + artifacts$mac } else { - return(artifacts$linux) + artifacts$linux } } diff --git a/R/util.R b/R/util.R index 17d5ace..6fa4dbb 100644 --- a/R/util.R +++ b/R/util.R @@ -81,13 +81,13 @@ select_assay <- function(obj) { #' @export counts_matrix_from_assay <- function(assay) { if (packageVersion("Seurat") >= package_version("5.0.0")) { - return(assay$counts) + assay$counts } else { if (is(assay, "Assay5")) { stop("Cannot get count matrix: Please upgrade to Seurat > 5 to support dataset") } - return(assay@counts) + assay@counts } } diff --git a/R/validate.R b/R/validate.R index 735d461..696ef74 100644 --- a/R/validate.R +++ b/R/validate.R @@ -180,21 +180,19 @@ validate_clusters <- function(clusters, barcode_count) { # nolint: cyclocomp_lin #' @export validate_projections <- function(projections, barcode_count) { # nolint: cyclocomp_linter. is_projection <- function(p) { - return(is.matrix(p)) + is.matrix(p) } # should have dimensions barcodeCount x 2 projection_dims_good <- function(p) { pdims <- dim(p) - return(pdims[[1]] == barcode_count && pdims[[2]] == 2) + pdims[[1]] == barcode_count && pdims[[2]] == 2 } # no values should be NaN or Infinite projection_values_good <- function(p) { - return( - !any(is.nan(p)) && - !any(is.infinite(p)) - ) + !any(is.nan(p)) && + !any(is.infinite(p)) } proj_names <- names(projections) diff --git a/tests/testthat/helper.R b/tests/testthat/helper.R index d678ebb..d8d6002 100644 --- a/tests/testthat/helper.R +++ b/tests/testthat/helper.R @@ -54,8 +54,8 @@ get_executable_path <- function() { wd <- getwd() os <- get_system_os() if (os == "windows") { - return(file.path(wd, "mock_louper.bat")) + file.path(wd, "mock_louper.bat") } else { - return(file.path(wd, "mock_louper")) + file.path(wd, "mock_louper") } }