diff --git a/tests/e2e/app-files/hello.R b/tests/e2e/app-files/hello.R index efc9f199..9567a26c 100644 --- a/tests/e2e/app-files/hello.R +++ b/tests/e2e/app-files/hello.R @@ -1,5 +1,5 @@ box::use( - shiny[ + shiny[ # nolint actionButton, bootstrapPage, isolate, @@ -11,7 +11,7 @@ box::use( tags, textInput, textOutput - ], # nolint + ], ) box::use(app/logic/say_hello[say_hello]) diff --git a/tests/testthat/test-linter_box_function_import_count_linter.R b/tests/testthat/test-linter_box_function_import_count_linter.R index d6dc7f42..3290aca1 100644 --- a/tests/testthat/test-linter_box_function_import_count_linter.R +++ b/tests/testthat/test-linter_box_function_import_count_linter.R @@ -39,6 +39,19 @@ three_function_imports_inline <- "box::use( dplyr[arrange, select, mutate, ], )" +no_lint <- "box::use( + dplyr[ # nolint + arrange, + select, + mutate, + distinct + ], +)" + +no_lint_inline <- "box::use( + dplyr[arrange, select, mutate, distinct], # nolint +)" + lint_message <- function(max = 5L) { rex::rex(glue::glue("Limit the function imports to a max of {max}.")) } @@ -65,3 +78,12 @@ test_that("box_func_import_count_linter blocks function imports more than max", lintr::expect_lint(six_function_imports, list(message = lint_msg), linter) lintr::expect_lint(six_function_imports_inline, list(message = lint_msg), linter) }) + +test_that("box_func_import_count_linter resepect # nolint", { + max <- 3 + linter <- box_func_import_count_linter(max = max) + lint_msg <- lint_message(max) + + lintr::expect_lint(no_lint, NULL, linter) + lintr::expect_lint(no_lint_inline, NULL, linter) +}) \ No newline at end of file