box_trailing_commas_linter {box.linters}R Documentation

box library trailing commas linter

Description

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.

Usage

box_trailing_commas_linter(check_functions = FALSE)

Arguments

check_functions

Boolean flag to include function imports between [ and ⁠]⁠. Defaults to FALSE.

Details

For use in rhino, see the Explanation: Rhino style guide to learn about the details.

Value

A custom linter function for use with r-lib/lintr

Examples

# will produce lints
lintr::lint(
  text = "box::use(base, rlang)",
  linters = box_trailing_commas_linter()
)

lintr::lint(
  text = "box::use(
   dplyr[select, mutate]
  )",
  linters = box_trailing_commas_linter()
)

# okay
lintr::lint(
  text = "box::use(base, rlang, )",
  linters = box_trailing_commas_linter()
)

lintr::lint(
  text = "box::use(
    dplyr[select, mutate],
  )",
  linters = box_trailing_commas_linter()
)


[Package box.linters version 0.10.0 Index]