Skip to contents

Make a new list based on lintr's default linters. The result of this function is meant to be passed to the linters argument of lint(), or to be put in your configuration file.


linters_with_defaults(..., defaults = default_linters)

with_defaults(..., default = default_linters)



Arguments of elements to change. If unnamed, the argument is automatically named. If the named argument already exists in the list of linters, it is replaced by the new element. If it does not exist, it is added. If the value is NULL, the linter is removed.

defaults, default

Default list of linters to modify. Must be named.

See also

linters_with_tags for basing off tags attached to linters, possibly across multiple packages. available_linters to get a data frame of available linters. linters for a complete list of linters available in lintr.


# When using interactively you will usually pass the result onto `lint` or `lint_package()`
if (FALSE) {
lint("foo.R", linters = linters_with_defaults(line_length_linter = line_length_linter(120)))
# the default linter list with a different line length cutoff
my_linters <- linters_with_defaults(line_length_linter = line_length_linter(120))

# omit the argument name if you are just using different arguments
my_linters <- linters_with_defaults(defaults = my_linters, object_name_linter("camelCase"))

# remove assignment checks (with NULL), add absolute path checks
my_linters <- linters_with_defaults(
  defaults = my_linters,
  assignment_linter = NULL,