Skip to content

Excluding Files

Both exclusion options described below accept a Bash v4-style path glob, either absolute or relative to your project directory. You can delimit multiple globs with a space, e.g., --option "Sources/Single.swift" "**/Generated/*.swift" "**/*.{xib,storyboard}".

To exclude the results from certain files, pass the --report-exclude <globs> option to the scan command.

Conversely, --report-include <globs> restricts the results to just the given files. It supersedes --report-exclude, and is useful when you want to focus on a single area of a large project.

Excluding files from the indexing phase means that any declarations and references contained within the files will not be seen by Periphery. Periphery will behave as if the files do not exist.

To exclude files from being indexed, there are a few options:

  1. Use --exclude-targets "TargetA" "TargetB" to exclude all source files in the chosen targets.
  2. Use --exclude-tests to exclude all test targets.
  3. Use --index-exclude "file.swift" "path/*.swift" to exclude individual source files.

To retain all declarations in files, pass the --retain-files <globs> option to the scan command. This option is equivalent to adding a // periphery:ignore:all comment command at the top of each file.