Sha256: 088ac41a9f9512d05ccd046bb48ba04073e97eea04a1386fe7e8a63bcb65e80e
Contents?: true
Size: 1.46 KB
Versions: 2
Compression:
Stored size: 1.46 KB
Contents
# Prevent Undefined Object Errors (`UndefinedObject`) This check ensures that no undefined variables are used, preventing errors in your Liquid code. It aims to eliminate undefined object errors and additionally reports any missing or unused attributes in `render`, `function`, and `background` tags. ## Examples The following examples show code snippets that either fail or pass this check: ### ✗ Incorrect Code Example (Avoid using this): ```liquid {% if greeting == "Hello" %} Hello {% endif %} ``` ### ✓ Correct Code Example (Use this instead): ```liquid {% assign greetings = "Hello" %} {% if greetings == "Hello" %} Hello {% endif %} ``` ```liquid {% function res = 'my_function' %} ``` ```liquid {% liquid # my_function body assign my_arg = my_arg | default: nil return my_arg %} ``` ## Configuration Options The default configuration for this check: ```yaml UndefinedObject: enabled: true ``` ## Disabling This Check Disabling this check is not recommended. ## Version This check has been introduced in platformOS Check 0.1.0. ## Resources - [platformOS Context](https://documentation.platformos.com/developer-guide/variables/context-variable#displaying-the-context-object) - [platformOS Object Reference](https://documentation.platformos.com/api-reference/liquid/objects) - [Rule Source][codesource] - [Documentation Source][docsource] [codesource]: /lib/platformos_check/checks/undefined_object.rb [docsource]: /docs/checks/undefined_object.md
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
platformos-check-0.4.14 | docs/checks/undefined_object.md |
platformos-check-0.4.13 | docs/checks/undefined_object.md |