Sha256: 989a7f8acff1072f4140bafb820fbdf30b0408771e3d5b156f2c6d5fc160b09a

Contents?: true

Size: 1.43 KB

Versions: 29

Compression:

Stored size: 1.43 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
{% comment %}templates/index.liquid{% endcomment %}
  {% render 'one' %}

{% comment %}snippets/one.liquid{% endcomment %}
  {% render 'two' %}

{% comment %}snippets/two.liquid{% endcomment %}
  {% render 'three' %}

{% comment %}snippets/three.liquid{% endcomment %}
  {% render 'four' %}

{% comment %}snippets/four.liquid{% endcomment %}
  ok
```

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

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

{% comment %}snippets/one.liquid{% endcomment %}
  {% render 'two' %}

{% comment %}snippets/two.liquid{% endcomment %}
  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

29 entries across 29 versions & 1 rubygems

Version Path
theme-check-1.10.3 docs/checks/nested_snippet.md
theme-check-1.10.2 docs/checks/nested_snippet.md
theme-check-1.10.1 docs/checks/nested_snippet.md
theme-check-1.10.0 docs/checks/nested_snippet.md
theme-check-1.9.2 docs/checks/nested_snippet.md
theme-check-1.9.1 docs/checks/nested_snippet.md
theme-check-1.9.0 docs/checks/nested_snippet.md
theme-check-1.8.0 docs/checks/nested_snippet.md
theme-check-1.7.2 docs/checks/nested_snippet.md
theme-check-1.7.1 docs/checks/nested_snippet.md
theme-check-1.7.0 docs/checks/nested_snippet.md
theme-check-1.6.2 docs/checks/nested_snippet.md
theme-check-1.6.1 docs/checks/nested_snippet.md
theme-check-1.6.0 docs/checks/nested_snippet.md
theme-check-1.5.2 docs/checks/nested_snippet.md
theme-check-1.5.1 docs/checks/nested_snippet.md
theme-check-1.5.0 docs/checks/nested_snippet.md
theme-check-1.4.0 docs/checks/nested_snippet.md
theme-check-1.3.0 docs/checks/nested_snippet.md
theme-check-1.2.0 docs/checks/nested_snippet.md