Skip to content

Commit

Permalink
docs: Minor documentation changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubnowicki committed Feb 20, 2024
1 parent 52dfc97 commit 96683d7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 21 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
1. Introduce linters for `box::use` statements:
* `box_universal_import_linter` checks if all imports are explicit.
* `box_trailing_commas_linter` checks if statements include trailing commas.
* `box_func_import_count_linter` checks if the number of function imports does not exceed the limit.
2. Major refactor of `rhino::app()`:
* The `request` parameter is now correctly forwarded to the UI function
when using a `legacy_entrypoint` ([#395](https://github.com/Appsilon/rhino/issues/395)).
Expand Down
32 changes: 16 additions & 16 deletions R/box_linters.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Box library function import count linter
#' `box` library function import count linter
#'
#' Checks that function imports do not exceed the defined `max`.
#'
Expand All @@ -9,23 +9,23 @@
#' @examples
#' # will produce lints
#' lintr::lint(
#' text = "box::use(package[one, two, three, four, five, six, ])",
#' text = "box::use(package[one, two, three, four, five, six, seven, eight, nine])",
#' linters = box_func_import_count_linter()
#' )
#'
#' lintr::lint(
#' text = "box::use(package[one, two, three, four, ])",
#' text = "box::use(package[one, two, three, four])",
#' linters = box_func_import_count_linter(3)
#' )
#'
#' # okay
#' lintr::lint(
#' text = "box::use(package[one, two, three, four, five, ])",
#' text = "box::use(package[one, two, three, four, five])",
#' linters = box_func_import_count_linter()
#' )
#'
#' lintr::lint(
#' text = "box::use(package[one, two, three, ])",
#' text = "box::use(package[one, two, three])",
#' linters = box_func_import_count_linter(3)
#' )
#'
Expand All @@ -35,17 +35,17 @@ box_func_import_count_linter <- function(max = 8L) {
(text() = 'box' and
following-sibling::SYMBOL_FUNCTION_CALL[text() = 'use'])
]
/parent::expr
/parent::expr
/descendant::OP-LEFT-BRACKET[
count(
following-sibling::expr[
count(. | ..//OP-RIGHT-BRACKET/preceding-sibling::expr) =
count(../OP-RIGHT-BRACKET/preceding-sibling::expr)
]
) > {max}
]
/parent::expr")
/parent::expr
/parent::expr
/descendant::OP-LEFT-BRACKET[
count(
following-sibling::expr[
count(. | ..//OP-RIGHT-BRACKET/preceding-sibling::expr) =
count(../OP-RIGHT-BRACKET/preceding-sibling::expr)
]
) > {max}
]
/parent::expr")

lint_message <- glue::glue("Limit the function imports to a max of {max}.")

Expand Down
10 changes: 5 additions & 5 deletions man/box_func_import_count_linter.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 96683d7

Please sign in to comment.