Skip to contents

Activating linters

Unlike rhino_default_linters, box_default_linters comes with only a subset of the linters provided in box.linters. Inactive linters can be added as needed.

The following activates box_func_import_count_linter() for box_default_linters

linters:
  linters_with_defaults(
    defaults = box.linters::box_default_linters,
    box_func_import_count_linter = box.linters::box_func_import_count_linter()
  )
encoding: "UTF-8"

Disabling linters

Specific linters can be disabled by setting the appropriate linter name to NULL:

The following disables box_func_import_count_linter():

linters:
  linters_with_defaults(
    defaults = box.linters::rhino_default_linters,
    box_func_import_count_linter = NULL
  )
linters:
  linters_with_defaults(
    defaults = box.linters::box_default_linters,
    box_pkg_fun_exists_linter = NULL
  )

Customizable linters

A few of the linters provided can be configured such as box_func_import_count_linter().

The following changes the maximum quantity of attached functions from 8 to 12:

linters:
  linters_with_defaults(
    defaults = box.linters::rhino_default_linters,
    box_func_import_count_linter = box.linters::box_func_import_count_linter(max = 12)
  )

The default linters provided by lintr can also be configured:

linters:
  linters_with_defaults(
    defaults = box.linters::box_default_linters,
    line_length_linter = lintr::line_length_linter(100)
  )

More information

For more detailed information on customizing linters, please proceed to the lintr documentation on Configuring linters