Recommends using {% liquid ... %}
if 4 or more consecutive liquid tags ({% ... %}
) are found.
This check is aimed at eliminating repetitive tag markers ({%
and %}
) in theme files.
👎 Example of incorrect code for this check:
{% if collection.image.size != 0 %}
{% assign collection_image = collection.image %}
{% elsif collection.products.first.size != 0 and collection.products.first.media != empty %}
{% assign collection_image = collection.products.first.featured_media.preview_image %}
{% else %}
{% assign collection_image = nil %}
{% endif %}
👍 Example of correct code for this check:
{%- liquid
if collection.image.size != 0
assign collection_image = collection.image
elsif collection.products.first.size != 0 and collection.products.first.media != empty
assign collection_image = collection.products.first.featured_media.preview_image
else
assign collection_image = nil
endif
-%}
The default configuration for this check is the following:
LiquidTag:
enabled: true
min_consecutive_statements: 5
The min_consecutive_statements
option (Default: 5
) determines the maximum (inclusive) number of consecutive statements before the check recommends a refactor.
It's safe to disable this rule.
This check has been introduced in Theme Check 0.1.0.