box
library unused attached package function linterR/box_unused_attached_pkg_fun_linter.R
box_unused_att_pkg_fun_linter.Rd
Checks that all attached package functions are used within the source file.
box_unused_att_pkg_fun_linter()
A custom linter function for use with r-lib/lintr
.
For use in rhino
, see the
Explanation: Rhino style guide
to learn about the details.
# will produce lints
code <- "
box::use(
stringr[str_pad],
)
"
lintr::lint(text = code, linters = box_unused_att_pkg_fun_linter())
#> <text>:3:11: warning: [box_unused_att_pkg_fun_linter] Imported function unused.
#> stringr[str_pad],
#> ^~~~~~~
code <- "
box::use(
stringr[alias_func = str_pad],
)
"
lintr::lint(text = code, linters = box_unused_att_pkg_fun_linter())
#> <text>:3:24: warning: [box_unused_att_pkg_fun_linter] Imported function unused.
#> stringr[alias_func = str_pad],
#> ^~~~~~~
# okay
code <- "
box::use(
stringr[str_pad],
)
str_pad()
"
lintr::lint(text = code, linters = box_unused_att_pkg_fun_linter())
#> ℹ No lints found.
code <- "
box::use(
stringr[alias_func = str_pad],
)
alias_func()
"
lintr::lint(text = code, linters = box_unused_att_pkg_fun_linter())
#> ℹ No lints found.