Skip to main content

BlockIdUsage

Warns against the use of block IDs in conditional statements and case statements.


The following examples contain code snippets that either fail or pass this check.

In the following example, block.id is being used in an if statement:

{% if block.id == 'my-block-id' %}
This is a bad idea.
{% endif %}

This applies to if, elsif, and unless statements.

In the following example, block.id is being used in a case statement:

{% case block.id %}
{% when 'my-block-id' %}
This is a bad idea.
{% endcase %}

The following example contains the default configuration for this check:

BlockIdUsage:
enabled: true
severity: warning
ParameterDescription
enabledWhether this check is enabled.
severityThe severity of the check.

Anchor to Disabling this checkDisabling this check

Disabling this check isn't recommended.


Was this page helpful?