box_unused_att_pkg_fun_linter: 'box' library unused attached package function linter

View source: R/box_unused_attached_pkg_fun_linter.R

box_unused_att_pkg_fun_linterR Documentation

box library unused attached package function linter

Description

Checks that all attached package functions are used within the source file.

Usage

box_unused_att_pkg_fun_linter()

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
code <- "
box::use(
  stringr[str_pad],
)
"

lintr::lint(text = code, linters = box_unused_att_pkg_fun_linter())

code <- "
box::use(
  stringr[alias_func = str_pad],
)
"

lintr::lint(text = code, linters = box_unused_att_pkg_fun_linter())

# okay
code <- "
box::use(
  stringr[str_pad],
)

str_pad()
"

lintr::lint(text = code, linters = box_unused_att_pkg_fun_linter())

code <- "
box::use(
  stringr[alias_func = str_pad],
)

alias_func()
"

lintr::lint(text = code, linters = box_unused_att_pkg_fun_linter())


box.linters documentation built on Sept. 11, 2024, 8:20 p.m.