Skip to content
This repository has been archived by the owner on Jul 27, 2024. It is now read-only.

Unused Snippets are not being detected in 1.10.2 #573

Closed
wrainbird opened this issue Apr 12, 2022 · 2 comments · Fixed by #615
Closed

Unused Snippets are not being detected in 1.10.2 #573

wrainbird opened this issue Apr 12, 2022 · 2 comments · Fixed by #615
Assignees
Labels
bug Something isn't working linter Check related issues

Comments

@wrainbird
Copy link

I have installed Shopify CLI with Theme Check (version 1.10.2) - and am not getting errors for Unused Snippets.

I have been creating Snippets on purpose in the snippets directory that aren't being used - but when I run 'theme check' I am getting no errors:

0 offenses detected, 0 offenses auto-correctable

Am I doing something wrong? I have a .theme-check.yml file but it is pretty basic (I am enabling Unused Snippet here just to double check):

ignore:
  - _src
  - _schema
  - _sections
  - node_modules/*

# Enable a custom check
ClassPartials:
  enabled: false

UnusedSnippet:
  enabled: true
  severity: error

Let me know if there is any other information I can provide to assist with this.

@charlespwd
Copy link
Contributor

Oh. So I just found out that we turn off the check (silently) when an expression is used in an render(or include) expression.

Which, I suspect, you do if you have an OS2 theme (since all it takes is one {% render block %} for this tripwire to be triggered).

I'll flag this as a bug and add it to our backlog as I don't have time to fix it right now.

@charlespwd charlespwd added the bug Something isn't working label Apr 12, 2022
@wrainbird
Copy link
Author

@charlespwd thanks for responding to this.

The only dynamic snippet I render for OS2 themes is for app blocks, e.g.:

{% when '@app' %}
{% render block %}

I removed that code temporarily and was able to find unused snippets. Thanks!

@charlespwd charlespwd added language server Language Server related issues linter Check related issues and removed language server Language Server related issues labels Jul 13, 2022
@charlespwd charlespwd self-assigned this Jul 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working linter Check related issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants