Skip to contents

Checks that function imports do not exceed the defined max. See the Explanation: Rhino style guide to learn about the details.

Usage

box_func_import_count_linter(max = 8L)

Arguments

max

Maximum function imports allowed between [ and ]. Defaults to 8.

Value

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

Examples

# will produce lints
lintr::lint(
  text = "box::use(package[one, two, three, four, five, six, seven, eight, nine])",
  linters = box_func_import_count_linter()
)
#> ::warning file=<text>,line=1,col=10::file=<text>,line=1,col=10,[box_func_import_count_linter] Limit the function imports to a max of 8.

lintr::lint(
  text = "box::use(package[one, two, three, four])",
  linters = box_func_import_count_linter(3)
)
#> ::warning file=<text>,line=1,col=10::file=<text>,line=1,col=10,[box_func_import_count_linter] Limit the function imports to a max of 3.

# okay
lintr::lint(
  text = "box::use(package[one, two, three, four, five])",
  linters = box_func_import_count_linter()
)

lintr::lint(
  text = "box::use(package[one, two, three])",
  linters = box_func_import_count_linter(3)
)