Sha256: cee6de42b6b81471b964eeed6e3b0575650a09943aa54c1ee9a945852122cd87

Contents?: true

Size: 1.38 KB

Versions: 13

Compression:

Stored size: 1.38 KB

Contents

# Prevent undefined object errors (`UndefinedObject`)

This check prevents errors by making sure that no undefined variables are being used

## Check Details

This check is aimed at eliminating undefined object errors. Additionally it reports any missing or unused attributes in render, function and background tags.

:-1: Examples of **incorrect** code for this check:

```liquid
{% if greeting == "Hello" %}
  Hello
{% endif %}
```

:+1: Examples of **correct** code for this check:

```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
%}
```



## Check Options

The default configuration for this check is the following:

```yaml
UndefinedObject:
  enabled: true
```

## When Not To Use It

It is discouraged to disable this rule.

## Version

This check has been introduced in Theme 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

13 entries across 13 versions & 1 rubygems

Version Path
platformos-check-0.4.12 docs/checks/undefined_object.md
platformos-check-0.4.11 docs/checks/undefined_object.md
platformos-check-0.4.10 docs/checks/undefined_object.md
platformos-check-0.4.9 docs/checks/undefined_object.md
platformos-check-0.4.8 docs/checks/undefined_object.md
platformos-check-0.4.7 docs/checks/undefined_object.md
platformos-check-0.4.6 docs/checks/undefined_object.md
platformos-check-0.4.5 docs/checks/undefined_object.md
platformos-check-0.4.4 docs/checks/undefined_object.md
platformos-check-0.4.3 docs/checks/undefined_object.md
platformos-check-0.4.2 docs/checks/undefined_object.md
platformos-check-0.4.1 docs/checks/undefined_object.md
platformos-check-0.4.0 docs/checks/undefined_object.md