
box
library trailing commas linter
Source: R/box_trailing_commas_linter.R
box_trailing_commas_linter.Rd
Checks that all box:use
imports have a trailing comma. This applies to
package or module imports between (
and )
, and, optionally, function imports between
[
and ]
. Take note that lintr::commas_linter()
may come into play.
Details
For use in rhino
, see the
Explanation: Rhino style guide
to learn about the details.
Examples
# will produce lints
lintr::lint(
text = "box::use(base, rlang)",
linters = box_trailing_commas_linter()
)
#> <text>:1:21: style: [box_trailing_commas_linter] Always have a trailing comma at the end of imports, before a `)`.
#> box::use(base, rlang)
#> ^
lintr::lint(
text = "box::use(
dplyr[select, mutate]
)",
linters = box_trailing_commas_linter()
)
#> <text>:3:3: style: [box_trailing_commas_linter] Always have a trailing comma at the end of imports, before a `)`.
#> )
#> ^
# okay
lintr::lint(
text = "box::use(base, rlang, )",
linters = box_trailing_commas_linter()
)
#> ℹ No lints found.
lintr::lint(
text = "box::use(
dplyr[select, mutate],
)",
linters = box_trailing_commas_linter()
)
#> ℹ No lints found.