Exclude lines or files from linting
exclude(lints, exclusions = settings$exclusions, linter_names = NULL, ...)
that need to be filtered.
manually specified exclusions
character vector of names of the active linters, used for parsing inline exclusions.
additional arguments passed to parse_exclusions()
Exclusions can be specified in three different ways.
Single line in the source file. default: # nolint
, possibly followed by a listing of linters to exclude.
If the listing is missing, all linters are excluded on that line. The default listing format is
# nolint: linter_name, linter2_name.
. There may not be anything between the colon and the line exclusion tag
and the listing must be terminated with a full stop (.
) for the linter list to be respected.
Line range in the source file. default: # nolint start
, # nolint end
. # nolint start
accepts linter
lists in the same form as # nolint
.
Exclusions parameter, a list with named and/or unnamed entries. Outer elements have the following characteristics:
Unnamed elements specify filenames or directories.
Named elements are a vector or list of line numbers, with Inf
indicating 'all lines'.
The name gives a path relative to the config.
Unnamed elements denote exclusion of all linters in the given path or directory.
Named elements, where the name specifies a linter, denote exclusion for that linter. For convenience, a vector can be used in place of a list whenever it would not introduce ambiguity, e.g. a character vector of files to exclude or a vector of lines to exclude.