Workspace.Filtering (Workspace v0.2.1)

View Source

The workspace filtering logic.

Most workspace tasks support various filtering methods, like excluding specific projects, including only projects with specific tags or with a specific modification status among other.

This module provides all filtering related functionality.

Summary

Functions

Filter the workspace projects based on the given options.

Functions

run(workspace, opts)

@spec run(workspace :: Workspace.State.t(), opts :: keyword()) :: Workspace.State.t()

Filter the workspace projects based on the given options.

It will iterate over all projects and wil set the :skip to true if the project is considered skippable. The decision is made based on the provided options.

A Workspace.State is returned with the projects updated.

Options

  • :exclude (list of atom/0) - a list of projects to be ignored. This has the highest priority, e.g. if the project is in the :ignore list it is always skipped.
  • :exclude_tags (list of t:Workspace.Project.tag()) - a list of tags to be ignored. Any project that has any of the provided tags will be skipped.
  • :project (list of atom/0) - a list of projects to consider. If set all projects that are not included in the list are considered skippable.
  • :tags (list of t:Workspace.Project.tag()) - a list of tags to be considered. All projects that do not have at least one the specified tags will be skipped.
  • :paths (list of t:String.t()) - a list of project paths to be considered. Only projects located under any of the provided path will be considered.
  • :dependency (atom/0) - keeps only projects that have the given dependency.
  • :dependent (atom/0) - keeps only dependencies of the given project.
  • :affected (boolean/0) - if set only the affected projects will be included and everything else will be skipped. Defaults to false.
  • :modified (boolean/0) - if set only the modified projects will be included. A project is considered modified if any file under the project's root (excluding files in the .gitignore) has changed. Defaults to false.
  • :only_roots (boolean/0) - if set only the root projects will be included and everything else will be skipped. Defaults to false.
  • :base (String.t/0) - The base git reference for detecting changed files, If not set only working tree changes will be included.
  • :head (String.t/0) - The head git reference for detecting changed files. It is used only if :base is set.

Filtering order

Notice that projects are filtered using the following precedence:

  • Excluded projects (:exclude or :exclude_tags options set)
  • Selected projects (:project or :tags option set)
  • Code status modifiers (:affected, :modified and :only_roots)