Checks that a given string has all the required placeholders. The
    possible placeholders are **{type}**, **{scope}** and **{subject}**.

    ``{type}`` are always required, ``{scope}`` is optional and
    ``{subject}`` are required only when ``label_position`` option is set to
    ``header``.

    If the pattern is invalid, raises :class:`click.UsageError`.

def label_pattern_option_validator(ctx, param, value):
    """Checks that a given string has all the required placeholders. The
    possible placeholders are **{type}**, **{scope}** and **{subject}**.

    ``{type}`` are always required, ``{scope}`` is optional and
    ``{subject}`` are required only when ``label_position`` option is set to
    ``header``.

    If the pattern is invalid, raises :class:`click.UsageError`.
    """

    missings = []
    label_position = ctx.params["label_position"]

    if "{type}" not in value:
        missings.append(style("{type}", fg="red", bold=True))

    if label_position == "header" and "{subject}" not in value:
        missings.append(style("{subject}", fg="red", bold=True))

    if missings:
        message = "\n"

        for placeholder in missings:
            message += f"  {x_mark} Missing {placeholder} placeholder.\n"

        ctx.fail(message)

    return value