theme-check 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31af33605da4e88e134907242224b4266afc76fede068c70a1ba6b8d84eb98cd
4
- data.tar.gz: 80c7427113fd20c02c02d87d8f598d49182d460a8691e06dbaa954872c4f83c2
3
+ metadata.gz: b17d14eb5abc8211b6b6ae9f3a676c44770775821a87ce0909412d3eddb81c35
4
+ data.tar.gz: 7bcad0d34832338dd8cd83f220b14c45b061b84b81c5ae2b3a18805aeb9400eb
5
5
  SHA512:
6
- metadata.gz: 486f6280ef9521a7d35a8c4dce9e146b652514cb16def7b70845e2b93993710f2b61bd22dd448954ab1e44adc62b10c84b8e93ac3895dd92c4c1c42911341c83
7
- data.tar.gz: '0171786d1c8bea48ba90a755cda22aea62da383b740b2cccc402dba210cc6d361a86704fe43617be2e489747bbb67a6614e4ab975d5fe2128e2f89da724a8ca3'
6
+ metadata.gz: 241dfdae6ec38c560ca4697c4b9256d4ceaed0300e9a575c3c92e864ea4fa2fd56420efd87ec2c0f744240fe9db5c6cc7df24c1da8d9606fab020bdd1d630450
7
+ data.tar.gz: bbb52dcf01cf1dcbc3f73fe90d822b9ee22407a31525aab314ad0121e1bd9f52c786b6528594e5eb6224d97e567108bd7962a8c7a67d6e17702a976bab3edb1a
data/CHANGELOG.md CHANGED
@@ -1,4 +1,10 @@
1
1
 
2
+ v0.3.3 / 2021-02-18
3
+ ==================
4
+
5
+ * Fix column_end issues ([#164](https://github.com/Shopify/theme-check/issues/164))
6
+ * Fix stack overflow in UndefinedObject + UnusedAssign when snippets renders itself ([#165](https://github.com/Shopify/theme-check/issues/165))
7
+
2
8
  v0.3.2 / 2021-02-17
3
9
  ==================
4
10
 
@@ -134,7 +134,7 @@ module ThemeCheck
134
134
  end
135
135
  end
136
136
 
137
- def check_object(info, all_global_objects, render_node = nil)
137
+ def check_object(info, all_global_objects, render_node = nil, visited_snippets = Set.new)
138
138
  check_undefined(info, all_global_objects, render_node)
139
139
 
140
140
  info.each_snippet do |(snippet_name, node)|
@@ -143,7 +143,10 @@ module ThemeCheck
143
143
 
144
144
  snippet_variables = node.value.attributes.keys +
145
145
  Array[node.value.instance_variable_get("@alias_name")]
146
- check_object(snippet_info, all_global_objects + snippet_variables, node)
146
+ unless visited_snippets.include?(snippet_name)
147
+ visited_snippets << snippet_name
148
+ check_object(snippet_info, all_global_objects + snippet_variables, node, visited_snippets)
149
+ end
147
150
  end
148
151
  end
149
152
 
@@ -6,12 +6,13 @@ module ThemeCheck
6
6
  category :liquid
7
7
 
8
8
  class TemplateInfo < Struct.new(:used_assigns, :assign_nodes, :includes)
9
- def collect_used_assigns(templates)
9
+ def collect_used_assigns(templates, visited = Set.new)
10
10
  collected = used_assigns
11
11
  # Check recursively inside included snippets for use
12
12
  includes.each do |name|
13
- if templates[name]
14
- collected += templates[name].collect_used_assigns(templates)
13
+ if templates[name] && !visited.include?(name)
14
+ visited << name
15
+ collected += templates[name].collect_used_assigns(templates, visited)
15
16
  end
16
17
  end
17
18
  collected
@@ -55,7 +55,9 @@ module ThemeCheck
55
55
  end
56
56
 
57
57
  def end_line
58
- if markup
58
+ if markup&.ends_with?("\n")
59
+ start_line + markup.count("\n") - 1
60
+ elsif markup
59
61
  start_line + markup.count("\n")
60
62
  else
61
63
  start_line
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ThemeCheck
3
- VERSION = "0.3.2"
3
+ VERSION = "0.3.3"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: theme-check
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marc-André Cournoyer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-17 00:00:00.000000000 Z
11
+ date: 2021-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: liquid