Arguments

Full Example
contracts:
  macros:
  - arguments:
    - filter:
      - name:
          include:
          - ^\w+\d+\s{1,3}$
          - include[_-]this
          exclude:
          - ^\w+\d+\s{1,3}$
          - exclude[_-]this
          match_all: true
      validations:
      - has_type

Filters

Filters (or Conditions) for reducing the scope of the contract. You may limit the number of arguments processed by the rules of this contract by defining one or more of the following filters.

name

Filter arguments based on their names.

Schema
name:
  include:
    default: []
    description: Patterns to match against for values to include
    items:
      type: string
    type: array
  exclude:
    default: []
    description: Patterns to match against for values to exclude
    items:
      type: string
    type: array
  match_all:
    default: false
    description: When True, all given patterns must match to be considered a match
      for either pattern type
    type: boolean
Example
name:
  include: .*i\s+am\s+a\s+regex\s+pattern.*
  exclude: .*i\s+am\s+a\s+regex\s+pattern.*
  match_all: false

You may also define the parameters for include directly on the definition like below.

name: .*i\s+am\s+a\s+regex\s+pattern.*

Validations

Validations (or Terms) to apply to the resources of this contract. These enforce certain standards that must be followed in order for the contract to be fulfilled.

has_description

Check whether the arguments have descriptions defined in their properties.

Note

This term does not need further configuration. Simply define the term’s name as an item in your configuration.

has_type

Check whether macro arguments have a data type configured in their properties.

Note

This term does not need further configuration. Simply define the term’s name as an item in your configuration.