Skip to contents

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.

  1. 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.

  2. line range in the source file. default: # nolint start, # nolint end. # nolint start accepts linter lists in the same form as # nolint.

  3. exclusions parameter, a named list of files with named lists of linters and lines to exclude them on, a named list of the files and lines to exclude, or just the filenames if you want to exclude the entire file, or the directory names if you want to exclude all files in a directory.