theme-check 0.3.1 → 0.3.2

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: babce309fcdbc1bb5121d93b5d7bc443aa5c2fc88481169be0efee6c141449e6
4
- data.tar.gz: df49e8b26223efd29341163b2a7125127f961647e9553655102ed772a9792b65
3
+ metadata.gz: 31af33605da4e88e134907242224b4266afc76fede068c70a1ba6b8d84eb98cd
4
+ data.tar.gz: 80c7427113fd20c02c02d87d8f598d49182d460a8691e06dbaa954872c4f83c2
5
5
  SHA512:
6
- metadata.gz: e703cfd5f85e5fb530532eafd3f47d403f3a45463da8e6a8682b605cc31d7e4a942db4e23da1f88354bc8c8e44c0fd903b83536c5db431f4ff68e3116666369f
7
- data.tar.gz: 74b032108d464ce48d931ded5147cb5613cb4db0e480904ac740b404f49969381aafb3b8debd657d6c660cc4549d99e977b9568c0c97ea8416b8b022034a3bd3
6
+ metadata.gz: 486f6280ef9521a7d35a8c4dce9e146b652514cb16def7b70845e2b93993710f2b61bd22dd448954ab1e44adc62b10c84b8e93ac3895dd92c4c1c42911341c83
7
+ data.tar.gz: '0171786d1c8bea48ba90a755cda22aea62da383b740b2cccc402dba210cc6d361a86704fe43617be2e489747bbb67a6614e4ab975d5fe2128e2f89da724a8ca3'
data/.rubocop.yml CHANGED
@@ -7,6 +7,7 @@ AllCops:
7
7
  TargetRubyVersion: 2.7
8
8
  Exclude:
9
9
  - 'vendor/bundle/**/*'
10
+ - 'packaging/builds/**/*'
10
11
 
11
12
  Metrics/MethodLength:
12
13
  Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,27 @@
1
+
2
+ v0.3.2 / 2021-02-17
3
+ ==================
4
+
5
+ * Ignore snippets in UndefinedObject check
6
+
7
+ v0.3.1 / 2021-02-16
8
+ ===================
9
+
10
+ * Fixup version flag
11
+
12
+ v0.3.0 / 2021-02-16
13
+ ===================
14
+
15
+ * Add ParserBlockingJavaScript Check ([#78](https://github.com/Shopify/theme-check/issues/78), [#146](https://github.com/Shopify/theme-check/issues/146))
16
+ * Internal refactor to enable running theme-check in servers ([#145](https://github.com/Shopify/theme-check/issues/145), [#148](https://github.com/Shopify/theme-check/issues/148))
17
+ * Add -v, --version flag ([#126](https://github.com/Shopify/theme-check/issues/126))
18
+ * Exclude content of {% schema %} in line count for TemplateLength ([#140](https://github.com/Shopify/theme-check/issues/140))
19
+ * Fix Language Server removed files bug ([#136](https://github.com/Shopify/theme-check/issues/136))
20
+ * Add ignore config ([#147](https://github.com/Shopify/theme-check/issues/147))
21
+ * Add ability to disable checks with comments ([#79](https://github.com/Shopify/theme-check/issues/79))
22
+ * Adding checks for shopify plus objects in checkout ([#121](https://github.com/Shopify/theme-check/issues/121))
23
+
24
+ v0.2.2 / 2021-01-22
25
+ ===================
26
+
27
+ * [Language Server] Send empty dianogstics to flush errors
data/RELEASING.md CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  ```bash
24
24
  VERSION=X.X.X
25
- cp packaging/builds/$VERSION/theme-check ../homebrew-shopify
25
+ cp packaging/builds/$VERSION/theme-check.rb ../homebrew-shopify
26
26
  ```
27
27
 
28
28
  4. Create a branch + a commit on the [`homebrew-shopify`](https://github.com/Shopify/homebrew-shopify) repository.
data/config/default.yml CHANGED
@@ -67,6 +67,7 @@ MissingRequiredTemplateFiles:
67
67
 
68
68
  UndefinedObject:
69
69
  enabled: true
70
+ exclude_snippets: true
70
71
 
71
72
  RequiredDirectories:
72
73
  enabled: true
@@ -49,23 +49,28 @@ module ThemeCheck
49
49
  end
50
50
  end
51
51
 
52
- def initialize
52
+ def initialize(exclude_snippets: false)
53
+ @exclude_snippets = exclude_snippets
53
54
  @files = {}
54
55
  end
55
56
 
56
57
  def on_document(node)
58
+ return if ignore?(node)
57
59
  @files[node.template.name] = TemplateInfo.new
58
60
  end
59
61
 
60
62
  def on_assign(node)
63
+ return if ignore?(node)
61
64
  @files[node.template.name].all_assigns[node.value.to] = node
62
65
  end
63
66
 
64
67
  def on_capture(node)
68
+ return if ignore?(node)
65
69
  @files[node.template.name].all_captures[node.value.instance_variable_get('@to')] = node
66
70
  end
67
71
 
68
72
  def on_for(node)
73
+ return if ignore?(node)
69
74
  @files[node.template.name].all_forloops[node.value.variable_name] = node
70
75
  end
71
76
 
@@ -75,6 +80,7 @@ module ThemeCheck
75
80
  end
76
81
 
77
82
  def on_render(node)
83
+ return if ignore?(node)
78
84
  return unless node.value.template_name_expr.is_a?(String)
79
85
 
80
86
  snippet_name = "snippets/#{node.value.template_name_expr}"
@@ -85,6 +91,7 @@ module ThemeCheck
85
91
  end
86
92
 
87
93
  def on_variable_lookup(node)
94
+ return if ignore?(node)
88
95
  @files[node.template.name].add_variable_lookup(
89
96
  name: node.value.name,
90
97
  node: node,
@@ -114,13 +121,18 @@ module ThemeCheck
114
121
  end
115
122
  end
116
123
 
124
+ private
125
+
126
+ def ignore?(node)
127
+ @exclude_snippets && node.template.snippet?
128
+ end
129
+
117
130
  def each_template
118
131
  @files.each do |(name, info)|
119
132
  next if name.starts_with?('snippets/')
120
133
  yield [name, info]
121
134
  end
122
135
  end
123
- private :each_template
124
136
 
125
137
  def check_object(info, all_global_objects, render_node = nil)
126
138
  check_undefined(info, all_global_objects, render_node)
@@ -134,7 +146,6 @@ module ThemeCheck
134
146
  check_object(snippet_info, all_global_objects + snippet_variables, node)
135
147
  end
136
148
  end
137
- private :check_object
138
149
 
139
150
  def check_undefined(info, all_global_objects, render_node)
140
151
  all_variables = info.all_variables
@@ -154,6 +165,5 @@ module ThemeCheck
154
165
  end
155
166
  end
156
167
  end
157
- private :check_undefined
158
168
  end
159
169
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ThemeCheck
3
- VERSION = "0.3.1"
3
+ VERSION = "0.3.2"
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.1
4
+ version: 0.3.2
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-16 00:00:00.000000000 Z
11
+ date: 2021-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: liquid
@@ -65,6 +65,7 @@ files:
65
65
  - ".github/workflows/theme-check.yml"
66
66
  - ".gitignore"
67
67
  - ".rubocop.yml"
68
+ - CHANGELOG.md
68
69
  - CODE_OF_CONDUCT.md
69
70
  - CONTRIBUTING.md
70
71
  - Gemfile