BlockIdUsage
Warns against the use of block IDs in conditional statements and case statements.
Anchor to ExamplesExamples
The following examples contain code snippets that either fail or pass this check.
Anchor to ✗ Fail✗ Fail
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.
Anchor to ✗ Fail✗ Fail
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 %}
Anchor to OptionsOptions
The following example contains the default configuration for this check:
BlockIdUsage
enabledtrue
severity warning
Parameter | Description |
---|---|
enabled | Whether this check is enabled. |
severity | The severity of the check. |
Anchor to Disabling this checkDisabling this check
Disabling this check isn't recommended.
Was this page helpful?