UnusedAssign
Last edit: Apr 01, 2026
UnusedAssign
Severity: warning | Type: LiquidHtml
This check helps prevent bloat in your platformOS application by identifying variable definitions that are not used. It covers both {% assign %} and {% function %} assignments and aims to eliminate unnecessary code and surface user errors.
Variables that start with _ (underscore) are exempt from this check and can be used as throwaway or private variables.
Examples
✗ Incorrect Code Example (Avoid using this):
{% assign this_variable_is_not_used = 1 %}
{% function this_variable_is_not_used = 'my_function' %}
✓ Correct Code Example (Use this instead):
{% assign this_variable_is_used = 1 %}
{% if this_variable_is_used == 1 %}
<span>Hello!</span>
{% endif %}
{% function this_variable_is_used = 'my_function' %}
{% if this_variable_is_used == 1 %}
<span>Hello!</span>
{% endif %}
If you need to call a function for its side effects without using the return value, start the variable name with an underscore:
{% function _ignore_this_var = 'my_function' %}
Configuration
The default configuration for this check:
UnusedAssign:
enabled: true
severity: warning
Disabling This Check
This check is safe to disable if you do not prioritize eliminating unused variables.