Skip to content

Commit

Permalink
nolint flag
Browse files Browse the repository at this point in the history
  • Loading branch information
radbasa committed Jan 12, 2024
1 parent 7f45a9c commit 4f92a33
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/e2e/app-files/hello.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
box::use(
shiny[
shiny[ # nolint
actionButton,
bootstrapPage,
isolate,
Expand All @@ -11,7 +11,7 @@ box::use(
tags,
textInput,
textOutput
], # nolint
],
)

box::use(app/logic/say_hello[say_hello])
Expand Down
22 changes: 22 additions & 0 deletions tests/testthat/test-linter_box_function_import_count_linter.R
Original file line number Diff line number Diff line change
Expand Up @@ -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}."))
}
Expand All @@ -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)
})

0 comments on commit 4f92a33

Please sign in to comment.