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

Commit

Permalink
Fix UnusedAssign false positives from {% render ... with var %}
Browse files Browse the repository at this point in the history
Fixes #582
  • Loading branch information
charlespwd committed Jul 18, 2022
1 parent c361f54 commit 63d00e1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/theme_check/tags.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class Render < Liquid::Tag

disable_tags "include"

attr_reader :template_name_expr, :attributes
attr_reader :template_name_expr, :variable_name_expr, :attributes

def initialize(tag_name, markup, options)
super
Expand All @@ -171,6 +171,7 @@ class ParseTreeVisitor < Liquid::ParseTreeVisitor
def children
[
@node.template_name_expr,
@node.variable_name_expr,
] + @node.attributes.values
end
end
Expand Down
2 changes: 2 additions & 0 deletions test/checks/unused_assign_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ def test_do_not_report_used_assigns
{{ 'a' | t: b }}
{% assign c = 1 %}
{{ 'a' | t: tags: c }}
{% assign d = 1 %}
{% render 'foo' with d %}
END
)
assert_offenses("", offenses)
Expand Down

0 comments on commit 63d00e1

Please sign in to comment.