Workspace.Checks.RequiredScopeTag (Workspace v0.2.1)

View Source

Checks that the project has at least one scope tag with the given scope.

This check can be used in order to validate that all (or some) of the workspace projects have at least one tag with the given scope defined. By default it is allowed to set only one tag for a scope, but you can override this by setting the :multiple option to true.

Common use cases

A common use case for this check is when you want to use scoped tags for enforcing boundaries or defining the architectural level of each package. In these cases it is a good practice to require all packages to have some specific scope allowed.

Configuration

  • :scope (atom/0) - Required. The required scope.

  • :multiple (boolean/0) - If set to true the same scope is allowed to be defined multiple times. If set to false (the default) the check will fail if the project has more than one tags with the given scope. The default value is false.

Example

In order to configure this check add the following, under checks, in your workspace config:

[
  module: Workspace.Checks.RequiredScopeTag,
  description: "all projects must have a {:type, _value} tag set",
  opts: [
    scope: :type   
  ]
]