Skip to contents

lintr-compatible linters for box modules in R

box.linters is an R package that provides the {lintr} package compatibility with {box} package modules. In addition to providing code-styling checks for box::use() function calls, box.linters includes a collection of linter functions to replace lintr::object_usage_linter().

While the primary purpose of box.linters is for use with the {rhino} package, its functions and features are available for use with any R code or project that uses the box package for modular R code.


lintr::object_usage_linter is not compatible with box modules.

# use of box modules

some_function <- function() {
  str_trim("  String with trailing and leading white space\t")
> lintr::lint(box-module.R)
<text>:6:3: warning: [object_usage_linter] no visible global function definition for 'str_trim'
  str_trim("  String with trailing and leading white space ")

In order to use lintr and box together, it was necessary to disable lintr::object_usage_linter():

            linters = lintr::linters_with_defaults(object_usage_linter = NULL))

However, this meant we lose the functionality provided by lintr::object_usage_linter().


Stable version:


Development version:

# install.packages("remotes")


Create a configuration file and run selected linters:

.lintr setup

# create a .lintr file

# a file:

# in a project:


Or, use box.linters manually with lintr:

# a file:
lintr::lint(filename.R, linters = box.linters::box_default_linters)

# in a project:
lintr::lint_dir(linters = box.linters::box_default_linters)


Or, use box.linters from within a rhino project:

# a .lintr file should already exist when a rhino project is created
# box.linters::use_box_lintr(type = "rhino")

# in a rhino project:

{glue} String Interpolation

box.linters also looks inside glue strings. The default opening and closing delimiters are “{” and “}”. glue provides a way to customize delimiters. Support for custom glue delimiters are provided project-wide by setting and glue.close options in the following manner:

  list( = "<<",
    glue.close = ">>"

This is consistent with glue::glue(), doubling the full delimiter escapes it.

Because setting and glue.close will be global or project-wide, it is advised to invoke glue in the following manner to avoid confusion:

glue::glue(..., .open = getOption(""), .close = getOption("glue.close"))


If you want to contribute to this project, please submit a regular PR, once you’re done with the new feature or bug fix.

Reporting a bug is also helpful - please use Github issues and describe your problem as detailed as possible.


Appsilon is a Posit (formerly RStudio) Full Service Certified Partner.
Learn more at

Get in touch

Explore the Rhinoverse - a family of R packages built around Rhino!

Subscribe for Shiny tutorials, exclusive articles, R/Shiny community events, and more.