Sha256: e2a6216faf5169f46a87a3fbda190261bc2398b90d8fe29cf355d5ec99c921a0

Contents?: true

Size: 1.27 KB

Versions: 6

Compression:

Stored size: 1.27 KB

Contents

# Prevent deeply nested snippets (`NestedSnippet`)

Reports deeply nested `render` tags (or deprecated `include` tags).

## Check Details

This check is aimed at eliminating excessive nesting of snippets.

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

```liquid
{% # templates/index.liquid %}
  {% render 'one' %}

{% # snippets/one.liquid %}
  {% render 'two' %}

{% # snippets/two.liquid %}
  {% render 'three' %}

{% # snippets/three.liquid %}
  {% render 'four' %}

{% # snippets/four.liquid %}
  ok
```

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

```liquid
{% # templates/index.liquid %}
  {% render 'one' %}

{% # snippets/one.liquid %}
  {% render 'two' %}

{% # snippets/two.liquid %}
  ok
```

## Check Options

The default configuration for this check is the following:

```yaml
NestedSnippet:
  enabled: true
  max_nesting_level: 3
```

### `max_nesting_level`

The `max_nesting_level` option (Default: `2`) determines the maximum depth of snippets rendering snippets.

## When Not To Use It

It's safe to disable this rule.

## Version

This check has been introduced in Theme Check 0.1.0.

## Resources

- [Rule Source][codesource]
- [Documentation Source][docsource]

[codesource]: /lib/theme_check/checks/nested_snippet.rb
[docsource]: /docs/checks/nested_snippet.md

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
theme-check-1.15.0 docs/checks/nested_snippet.md
theme-check-1.14.0 docs/checks/nested_snippet.md
theme-check-1.13.0 docs/checks/nested_snippet.md
theme-check-1.12.1 docs/checks/nested_snippet.md
theme-check-1.12.0 docs/checks/nested_snippet.md
theme-check-1.11.0 docs/checks/nested_snippet.md