From 3acff6906058687c766503edcc910b3e874c61a0 Mon Sep 17 00:00:00 2001 From: olivroy Date: Thu, 2 Jan 2025 13:05:42 -0500 Subject: [PATCH] fix lints --- .lintr | 6 +++++- R/remove_labels.R | 3 ++- tests/testthat/test-to_labelled.r | 5 ++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.lintr b/.lintr index caa183c..4f768d2 100644 --- a/.lintr +++ b/.lintr @@ -1,2 +1,6 @@ -linters: linters_with_defaults(object_name_linter=NULL, cyclocomp_linter=NULL, object_length_linter=NULL) # see vignette("lintr") +linters: linters_with_defaults(object_name_linter=NULL, cyclocomp_linter=NULL, object_length_linter=NULL, object_usage_linter = NULL) # see vignette("lintr") encoding: "UTF-8" +exclusions: list( + "R/import-standalone-obj-type.R", + "R/import-standalone-types-check.R" + ) diff --git a/R/remove_labels.R b/R/remove_labels.R index 07c5ae5..e03d0ef 100644 --- a/R/remove_labels.R +++ b/R/remove_labels.R @@ -152,7 +152,8 @@ remove_user_na.haven_labelled_spss <- function(x, if (length(val_to_tag) > 26) { cli::cli_warn(c( - "{length(val_to_tag)} different user-defined missing values found in 'x'.", + "{length(val_to_tag)} different user-defined missing + values found in 'x'.", i = "A maximum of 26 could be tagged.", "!" = "'user_na_to_tagged_na' has been ignored.", i = "'user_na_to_na = TRUE' has been used instead." diff --git a/tests/testthat/test-to_labelled.r b/tests/testthat/test-to_labelled.r index 80a2113..2104676 100644 --- a/tests/testthat/test-to_labelled.r +++ b/tests/testthat/test-to_labelled.r @@ -114,9 +114,8 @@ test_that("foreign_to_labelled works correctly", { function(x) { if (x$type == "none") { return(NULL) - } else { - return(x$value) } + x$value } ) expect_equal(sapply(tl_spss_list, na_values), miss_list) @@ -197,7 +196,7 @@ test_that("memisc_to_labelled works correctly", { } vals <- vlabs@values names(vals) <- vlabs@.Data - return(vals) + vals }) expect_identical(val_labels(tl_ds), val_labels_ds) }