UndefinedObject
Identifies unknown variable references. Liquid variables must declared using assign
tags, capture
tags, or documented with @param
inside of LiquidDoc. Some Liquid variables exist by default in a global scope. See Liquid objects.
Anchor to ExamplesExamples
The following examples contain code snippets that either fail or pass this check for different scenarios.
Anchor to ✓ Pass✓ Pass
This check passes when properly calling global Liquid objects.
blocks/my-block.liquid
Anchor to ✗ Fail✗ Fail
This check fails when a variable is used in a block before it has been assigned using assign
or capture
. This check is skipped for snippet files unless it contains LiquidDoc. See examples below.
blocks/my-block.liquid
Anchor to ✓ Pass✓ Pass
This check passes when a variable has been assigned in a block before use.
blocks/my-block.liquid
Anchor to ✗ Fail✗ Fail
This check fails when a variable is used within a snippet or block file, but is neither defined locally nor documented with @param
within that file's {% doc %}
tag.
snippets/my-snippet.liquid
Anchor to ✓ Pass✓ Pass
This check passes when a variable used within a snippet or block is documented with @param
.
snippets/my-snippet.liquid
Anchor to OptionsOptions
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 as it helps catch typos and potential runtime errors.