theme-check 1.10.3 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +29 -0
  3. data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  4. data/.github/workflows/cla.yml +22 -0
  5. data/.github/workflows/theme-check.yml +1 -1
  6. data/.gitignore +3 -0
  7. data/CHANGELOG.md +48 -0
  8. data/CONTRIBUTING.md +82 -0
  9. data/README.md +11 -8
  10. data/Rakefile +7 -0
  11. data/TROUBLESHOOTING.md +65 -0
  12. data/config/default.yml +4 -0
  13. data/data/shopify_liquid/built_in_liquid_objects.json +60 -0
  14. data/data/shopify_liquid/documentation/filters.json +5528 -0
  15. data/data/shopify_liquid/documentation/latest.json +1 -0
  16. data/data/shopify_liquid/documentation/objects.json +19272 -0
  17. data/data/shopify_liquid/documentation/tags.json +1252 -0
  18. data/data/shopify_liquid/filters.yml +18 -0
  19. data/dev.yml +1 -1
  20. data/docs/checks/asset_preload.md +60 -0
  21. data/docs/checks/asset_size_javascript.md +2 -2
  22. data/docs/checks/missing_enable_comment.md +3 -3
  23. data/docs/checks/nested_snippet.md +8 -8
  24. data/docs/checks/translation_key_exists.md +4 -4
  25. data/docs/checks/valid_html_translation.md +1 -1
  26. data/lib/theme_check/analyzer.rb +18 -3
  27. data/lib/theme_check/check.rb +6 -1
  28. data/lib/theme_check/checks/asset_preload.rb +20 -0
  29. data/lib/theme_check/checks/deprecated_filter.rb +29 -5
  30. data/lib/theme_check/checks/missing_enable_comment.rb +4 -0
  31. data/lib/theme_check/checks/missing_required_template_files.rb +5 -1
  32. data/lib/theme_check/checks/missing_template.rb +5 -1
  33. data/lib/theme_check/checks/undefined_object.rb +4 -0
  34. data/lib/theme_check/checks/unused_assign.rb +6 -1
  35. data/lib/theme_check/checks/unused_snippet.rb +50 -2
  36. data/lib/theme_check/config.rb +2 -2
  37. data/lib/theme_check/disabled_checks.rb +11 -4
  38. data/lib/theme_check/file_system_storage.rb +2 -0
  39. data/lib/theme_check/in_memory_storage.rb +1 -1
  40. data/lib/theme_check/language_server/bridge.rb +31 -6
  41. data/lib/theme_check/language_server/completion_context.rb +52 -0
  42. data/lib/theme_check/language_server/completion_engine.rb +15 -21
  43. data/lib/theme_check/language_server/completion_provider.rb +16 -1
  44. data/lib/theme_check/language_server/completion_providers/assignments_completion_provider.rb +36 -0
  45. data/lib/theme_check/language_server/completion_providers/filter_completion_provider.rb +49 -6
  46. data/lib/theme_check/language_server/completion_providers/object_attribute_completion_provider.rb +47 -0
  47. data/lib/theme_check/language_server/completion_providers/object_completion_provider.rb +10 -7
  48. data/lib/theme_check/language_server/completion_providers/render_snippet_completion_provider.rb +5 -1
  49. data/lib/theme_check/language_server/completion_providers/tag_completion_provider.rb +8 -1
  50. data/lib/theme_check/language_server/diagnostics_engine.rb +80 -34
  51. data/lib/theme_check/language_server/diagnostics_manager.rb +27 -6
  52. data/lib/theme_check/language_server/execute_command_providers/run_checks_execute_command_provider.rb +7 -6
  53. data/lib/theme_check/language_server/handler.rb +93 -9
  54. data/lib/theme_check/language_server/protocol.rb +9 -0
  55. data/lib/theme_check/language_server/server.rb +42 -14
  56. data/lib/theme_check/language_server/type_helper.rb +22 -0
  57. data/lib/theme_check/language_server/variable_lookup_finder/assignments_finder/node_handler.rb +63 -0
  58. data/lib/theme_check/language_server/variable_lookup_finder/assignments_finder/scope.rb +57 -0
  59. data/lib/theme_check/language_server/variable_lookup_finder/assignments_finder/scope_visitor.rb +42 -0
  60. data/lib/theme_check/language_server/variable_lookup_finder/assignments_finder.rb +76 -0
  61. data/lib/theme_check/language_server/variable_lookup_finder/constants.rb +43 -0
  62. data/lib/theme_check/language_server/variable_lookup_finder/liquid_fixer.rb +103 -0
  63. data/lib/theme_check/language_server/variable_lookup_finder/potential_lookup.rb +10 -0
  64. data/lib/theme_check/language_server/variable_lookup_finder/tolerant_parser.rb +94 -0
  65. data/lib/theme_check/language_server/variable_lookup_finder.rb +60 -100
  66. data/lib/theme_check/language_server/variable_lookup_traverser.rb +70 -0
  67. data/lib/theme_check/language_server/versioned_in_memory_storage.rb +17 -2
  68. data/lib/theme_check/language_server.rb +12 -0
  69. data/lib/theme_check/liquid_file.rb +22 -1
  70. data/lib/theme_check/liquid_node.rb +33 -1
  71. data/lib/theme_check/liquid_visitor.rb +1 -1
  72. data/lib/theme_check/remote_asset_file.rb +13 -7
  73. data/lib/theme_check/schema_helper.rb +1 -1
  74. data/lib/theme_check/shopify_liquid/documentation/markdown_template.rb +51 -0
  75. data/lib/theme_check/shopify_liquid/documentation.rb +44 -0
  76. data/lib/theme_check/shopify_liquid/filter.rb +4 -0
  77. data/lib/theme_check/shopify_liquid/object.rb +4 -0
  78. data/lib/theme_check/shopify_liquid/source_index/base_entry.rb +60 -0
  79. data/lib/theme_check/shopify_liquid/source_index/base_state.rb +23 -0
  80. data/lib/theme_check/shopify_liquid/source_index/filter_entry.rb +18 -0
  81. data/lib/theme_check/shopify_liquid/source_index/filter_state.rb +11 -0
  82. data/lib/theme_check/shopify_liquid/source_index/object_entry.rb +14 -0
  83. data/lib/theme_check/shopify_liquid/source_index/object_state.rb +11 -0
  84. data/lib/theme_check/shopify_liquid/source_index/parameter_entry.rb +21 -0
  85. data/lib/theme_check/shopify_liquid/source_index/property_entry.rb +9 -0
  86. data/lib/theme_check/shopify_liquid/source_index/return_type_entry.rb +37 -0
  87. data/lib/theme_check/shopify_liquid/source_index/tag_entry.rb +20 -0
  88. data/lib/theme_check/shopify_liquid/source_index/tag_state.rb +11 -0
  89. data/lib/theme_check/shopify_liquid/source_index.rb +56 -0
  90. data/lib/theme_check/shopify_liquid/source_manager.rb +111 -0
  91. data/lib/theme_check/shopify_liquid/tag.rb +4 -0
  92. data/lib/theme_check/shopify_liquid.rb +17 -1
  93. data/lib/theme_check/tags.rb +2 -1
  94. data/lib/theme_check/version.rb +1 -1
  95. data/shipit.rubygems.yml +3 -0
  96. data/theme-check.gemspec +5 -3
  97. metadata +45 -6
  98. data/.github/probots.yml +0 -3
@@ -1,6 +1,22 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require_relative 'shopify_liquid/deprecated_filter'
4
+ require_relative 'shopify_liquid/documentation'
3
5
  require_relative 'shopify_liquid/filter'
4
6
  require_relative 'shopify_liquid/object'
5
- require_relative 'shopify_liquid/tag'
7
+ require_relative 'shopify_liquid/source_manager'
8
+ require_relative 'shopify_liquid/source_index'
6
9
  require_relative 'shopify_liquid/system_translations'
10
+ require_relative 'shopify_liquid/tag'
11
+
12
+ require_relative 'shopify_liquid/source_index/base_entry'
13
+ require_relative 'shopify_liquid/source_index/filter_entry'
14
+ require_relative 'shopify_liquid/source_index/object_entry'
15
+ require_relative 'shopify_liquid/source_index/parameter_entry'
16
+ require_relative 'shopify_liquid/source_index/property_entry'
17
+ require_relative 'shopify_liquid/source_index/return_type_entry'
18
+ require_relative 'shopify_liquid/source_index/tag_entry'
19
+ require_relative 'shopify_liquid/source_index/base_state'
20
+ require_relative 'shopify_liquid/source_index/filter_state'
21
+ require_relative 'shopify_liquid/source_index/object_state'
22
+ require_relative 'shopify_liquid/source_index/tag_state'
@@ -145,7 +145,7 @@ module ThemeCheck
145
145
 
146
146
  disable_tags "include"
147
147
 
148
- attr_reader :template_name_expr, :attributes
148
+ attr_reader :template_name_expr, :variable_name_expr, :attributes
149
149
 
150
150
  def initialize(tag_name, markup, options)
151
151
  super
@@ -171,6 +171,7 @@ module ThemeCheck
171
171
  def children
172
172
  [
173
173
  @node.template_name_expr,
174
+ @node.variable_name_expr,
174
175
  ] + @node.attributes.values
175
176
  end
176
177
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ThemeCheck
3
- VERSION = "1.10.3"
3
+ VERSION = "1.12.0"
4
4
  end
@@ -0,0 +1,3 @@
1
+ deploy:
2
+ pre:
3
+ - bundle exec rake download_theme_liquid_docs
data/theme-check.gemspec CHANGED
@@ -13,18 +13,20 @@ Gem::Specification.new do |spec|
13
13
  spec.homepage = "https://github.com/Shopify/theme-check"
14
14
  spec.license = "MIT"
15
15
 
16
- spec.required_ruby_version = ">= 2.6"
16
+ spec.required_ruby_version = ">= 2.7"
17
17
 
18
18
  spec.metadata['allowed_push_host'] = 'https://rubygems.org'
19
19
 
20
20
  spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
21
- %x{git ls-files -z}.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
+ # Load all files tracked in git except files in test directory
22
+ # Include untracked files in liquid documentation folder
23
+ %x{git ls-files -z}.split("\x0").reject { |f| f.match(%r{^test/}) } + Dir['data/shopify_liquid/documentation/**']
22
24
  end
23
25
  spec.bindir = "exe"
24
26
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
27
  spec.require_paths = ["lib"]
26
28
 
27
- spec.add_dependency('liquid', '>= 5.1.0')
29
+ spec.add_dependency('liquid', '>= 5.4.0')
28
30
  spec.add_dependency('nokogiri', '>= 1.12')
29
31
  spec.add_dependency('parser', '~> 3')
30
32
  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: 1.10.3
4
+ version: 1.12.0
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: 2022-06-17 00:00:00.000000000 Z
11
+ date: 2022-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: liquid
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 5.1.0
19
+ version: 5.4.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 5.1.0
26
+ version: 5.4.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: nokogiri
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -61,7 +61,9 @@ executables:
61
61
  extensions: []
62
62
  extra_rdoc_files: []
63
63
  files:
64
- - ".github/probots.yml"
64
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
65
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
66
+ - ".github/workflows/cla.yml"
65
67
  - ".github/workflows/theme-check.yml"
66
68
  - ".gitignore"
67
69
  - ".rubocop.yml"
@@ -74,12 +76,18 @@ files:
74
76
  - README.md
75
77
  - RELEASING.md
76
78
  - Rakefile
79
+ - TROUBLESHOOTING.md
77
80
  - bin/theme-check
78
81
  - bin/theme-check-language-server
79
82
  - config/default.yml
80
83
  - config/nothing.yml
81
84
  - config/theme_app_extension.yml
85
+ - data/shopify_liquid/built_in_liquid_objects.json
82
86
  - data/shopify_liquid/deprecated_filters.yml
87
+ - data/shopify_liquid/documentation/filters.json
88
+ - data/shopify_liquid/documentation/latest.json
89
+ - data/shopify_liquid/documentation/objects.json
90
+ - data/shopify_liquid/documentation/tags.json
83
91
  - data/shopify_liquid/filters.yml
84
92
  - data/shopify_liquid/objects.yml
85
93
  - data/shopify_liquid/plus_objects.yml
@@ -93,6 +101,7 @@ files:
93
101
  - docs/api/liquid_check.md
94
102
  - docs/checks/TEMPLATE.md.erb
95
103
  - docs/checks/app_block_valid_tags.md
104
+ - docs/checks/asset_preload.md
96
105
  - docs/checks/asset_size_app_block_css.md
97
106
  - docs/checks/asset_size_app_block_javascript.md
98
107
  - docs/checks/asset_size_css.md
@@ -153,6 +162,7 @@ files:
153
162
  - lib/theme_check/checks.rb
154
163
  - lib/theme_check/checks/TEMPLATE.rb.erb
155
164
  - lib/theme_check/checks/app_block_valid_tags.rb
165
+ - lib/theme_check/checks/asset_preload.rb
156
166
  - lib/theme_check/checks/asset_size_app_block_css.rb
157
167
  - lib/theme_check/checks/asset_size_app_block_javascript.rb
158
168
  - lib/theme_check/checks/asset_size_css.rb
@@ -218,10 +228,13 @@ files:
218
228
  - lib/theme_check/language_server/code_action_provider.rb
219
229
  - lib/theme_check/language_server/code_action_providers/quickfix_code_action_provider.rb
220
230
  - lib/theme_check/language_server/code_action_providers/source_fix_all_code_action_provider.rb
231
+ - lib/theme_check/language_server/completion_context.rb
221
232
  - lib/theme_check/language_server/completion_engine.rb
222
233
  - lib/theme_check/language_server/completion_helper.rb
223
234
  - lib/theme_check/language_server/completion_provider.rb
235
+ - lib/theme_check/language_server/completion_providers/assignments_completion_provider.rb
224
236
  - lib/theme_check/language_server/completion_providers/filter_completion_provider.rb
237
+ - lib/theme_check/language_server/completion_providers/object_attribute_completion_provider.rb
225
238
  - lib/theme_check/language_server/completion_providers/object_completion_provider.rb
226
239
  - lib/theme_check/language_server/completion_providers/render_snippet_completion_provider.rb
227
240
  - lib/theme_check/language_server/completion_providers/tag_completion_provider.rb
@@ -247,8 +260,18 @@ files:
247
260
  - lib/theme_check/language_server/protocol.rb
248
261
  - lib/theme_check/language_server/server.rb
249
262
  - lib/theme_check/language_server/tokens.rb
263
+ - lib/theme_check/language_server/type_helper.rb
250
264
  - lib/theme_check/language_server/uri_helper.rb
251
265
  - lib/theme_check/language_server/variable_lookup_finder.rb
266
+ - lib/theme_check/language_server/variable_lookup_finder/assignments_finder.rb
267
+ - lib/theme_check/language_server/variable_lookup_finder/assignments_finder/node_handler.rb
268
+ - lib/theme_check/language_server/variable_lookup_finder/assignments_finder/scope.rb
269
+ - lib/theme_check/language_server/variable_lookup_finder/assignments_finder/scope_visitor.rb
270
+ - lib/theme_check/language_server/variable_lookup_finder/constants.rb
271
+ - lib/theme_check/language_server/variable_lookup_finder/liquid_fixer.rb
272
+ - lib/theme_check/language_server/variable_lookup_finder/potential_lookup.rb
273
+ - lib/theme_check/language_server/variable_lookup_finder/tolerant_parser.rb
274
+ - lib/theme_check/language_server/variable_lookup_traverser.rb
252
275
  - lib/theme_check/language_server/versioned_in_memory_storage.rb
253
276
  - lib/theme_check/liquid_check.rb
254
277
  - lib/theme_check/liquid_file.rb
@@ -268,8 +291,23 @@ files:
268
291
  - lib/theme_check/schema_helper.rb
269
292
  - lib/theme_check/shopify_liquid.rb
270
293
  - lib/theme_check/shopify_liquid/deprecated_filter.rb
294
+ - lib/theme_check/shopify_liquid/documentation.rb
295
+ - lib/theme_check/shopify_liquid/documentation/markdown_template.rb
271
296
  - lib/theme_check/shopify_liquid/filter.rb
272
297
  - lib/theme_check/shopify_liquid/object.rb
298
+ - lib/theme_check/shopify_liquid/source_index.rb
299
+ - lib/theme_check/shopify_liquid/source_index/base_entry.rb
300
+ - lib/theme_check/shopify_liquid/source_index/base_state.rb
301
+ - lib/theme_check/shopify_liquid/source_index/filter_entry.rb
302
+ - lib/theme_check/shopify_liquid/source_index/filter_state.rb
303
+ - lib/theme_check/shopify_liquid/source_index/object_entry.rb
304
+ - lib/theme_check/shopify_liquid/source_index/object_state.rb
305
+ - lib/theme_check/shopify_liquid/source_index/parameter_entry.rb
306
+ - lib/theme_check/shopify_liquid/source_index/property_entry.rb
307
+ - lib/theme_check/shopify_liquid/source_index/return_type_entry.rb
308
+ - lib/theme_check/shopify_liquid/source_index/tag_entry.rb
309
+ - lib/theme_check/shopify_liquid/source_index/tag_state.rb
310
+ - lib/theme_check/shopify_liquid/source_manager.rb
273
311
  - lib/theme_check/shopify_liquid/system_translations.rb
274
312
  - lib/theme_check/shopify_liquid/tag.rb
275
313
  - lib/theme_check/storage.rb
@@ -280,6 +318,7 @@ files:
280
318
  - lib/theme_check/theme_file_rewriter.rb
281
319
  - lib/theme_check/version.rb
282
320
  - packaging/homebrew/theme_check.base.rb
321
+ - shipit.rubygems.yml
283
322
  - theme-check.gemspec
284
323
  homepage: https://github.com/Shopify/theme-check
285
324
  licenses:
@@ -294,7 +333,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
294
333
  requirements:
295
334
  - - ">="
296
335
  - !ruby/object:Gem::Version
297
- version: '2.6'
336
+ version: '2.7'
298
337
  required_rubygems_version: !ruby/object:Gem::Requirement
299
338
  requirements:
300
339
  - - ">="
data/.github/probots.yml DELETED
@@ -1,3 +0,0 @@
1
- # .github/probots.yml
2
- enabled:
3
- - cla