diff --git a/R/linter_box_separate_packages_modules.R b/R/linter_box_separate_packages_modules.R index 94f818bb..b25ee875 100644 --- a/R/linter_box_separate_packages_modules.R +++ b/R/linter_box_separate_packages_modules.R @@ -1,7 +1,7 @@ #' Box library separate packages and module imports linter -#' +#' #' Checks that packages and modules are imported in separate `box::use()` statements. -#' +#' #' @examples #' # will produce lints #' lintr::lint( @@ -13,7 +13,7 @@ #' text = "box::use(path/to/file, package)", #' linters = box_separate_calls_linter() #' ) -#' +#' #' # okay #' lintr::lint( #' text = "box::use(package1, package2) @@ -32,7 +32,7 @@ box_separate_calls_linter <- function() { ] " lint_message <- "Separate packages and modules in their respective box::use() calls." - + lintr::Linter(function(source_expression) { if (!lintr::is_lint_level(source_expression, "file")) { return(list()) diff --git a/tests/testthat/test-linter_box_separate_packages_modules.R b/tests/testthat/test-linter_box_separate_packages_modules.R index 77494d6b..d9302ca4 100644 --- a/tests/testthat/test-linter_box_separate_packages_modules.R +++ b/tests/testthat/test-linter_box_separate_packages_modules.R @@ -22,13 +22,13 @@ lint_message <- rex::rex("Separate packages and modules in their respective box: test_that("box_separate_calls_linter skips allowed box::use() calls", { linter <- box_separate_calls_linter() - + lintr::expect_lint(good_box_calls, NULL, linter) }) test_that("box_separate_calls_linter blocks packages and modules in same box::use() call", { linter <- box_separate_calls_linter() - + lintr::expect_lint(bad_box_call_1, list(message = lint_message), linter) lintr::expect_lint(bad_box_call_2, list(message = lint_message), linter) })