theme-check 0.5.0 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/theme-check.yml +10 -3
- data/.rubocop.yml +6 -3
- data/CHANGELOG.md +35 -0
- data/Gemfile +5 -3
- data/LICENSE.md +2 -0
- data/README.md +3 -0
- data/RELEASING.md +10 -3
- data/Rakefile +6 -0
- data/config/default.yml +11 -1
- data/data/shopify_translation_keys.yml +850 -0
- data/docs/checks/asset_size_css.md +52 -0
- data/docs/checks/img_width_and_height.md +79 -0
- data/docs/checks/parser_blocking_javascript.md +3 -3
- data/docs/checks/remote_asset.md +82 -0
- data/exe/theme-check +1 -1
- data/lib/theme_check.rb +1 -0
- data/lib/theme_check/check.rb +1 -1
- data/lib/theme_check/checks/asset_size_css.rb +89 -0
- data/lib/theme_check/checks/asset_size_javascript.rb +2 -8
- data/lib/theme_check/checks/img_width_and_height.rb +74 -0
- data/lib/theme_check/checks/matching_translations.rb +1 -1
- data/lib/theme_check/checks/parser_blocking_javascript.rb +6 -14
- data/lib/theme_check/checks/remote_asset.rb +99 -0
- data/lib/theme_check/checks/translation_key_exists.rb +13 -1
- data/lib/theme_check/checks/undefined_object.rb +1 -1
- data/lib/theme_check/checks/valid_html_translation.rb +1 -1
- data/lib/theme_check/cli.rb +106 -51
- data/lib/theme_check/config.rb +3 -0
- data/lib/theme_check/disabled_checks.rb +2 -2
- data/lib/theme_check/in_memory_storage.rb +13 -8
- data/lib/theme_check/language_server.rb +2 -0
- data/lib/theme_check/language_server/completion_engine.rb +3 -3
- data/lib/theme_check/language_server/completion_provider.rb +4 -0
- data/lib/theme_check/language_server/completion_providers/filter_completion_provider.rb +6 -2
- data/lib/theme_check/language_server/completion_providers/object_completion_provider.rb +1 -1
- data/lib/theme_check/language_server/completion_providers/render_snippet_completion_provider.rb +43 -0
- data/lib/theme_check/language_server/completion_providers/tag_completion_provider.rb +2 -2
- data/lib/theme_check/language_server/constants.rb +10 -0
- data/lib/theme_check/language_server/document_link_engine.rb +48 -0
- data/lib/theme_check/language_server/handler.rb +56 -17
- data/lib/theme_check/language_server/server.rb +4 -4
- data/lib/theme_check/liquid_check.rb +11 -0
- data/lib/theme_check/node.rb +1 -2
- data/lib/theme_check/offense.rb +3 -1
- data/lib/theme_check/packager.rb +1 -1
- data/lib/theme_check/releaser.rb +39 -0
- data/lib/theme_check/remote_asset_file.rb +1 -1
- data/lib/theme_check/shopify_liquid/deprecated_filter.rb +10 -8
- data/lib/theme_check/shopify_liquid/filter.rb +3 -5
- data/lib/theme_check/shopify_liquid/object.rb +2 -6
- data/lib/theme_check/shopify_liquid/tag.rb +1 -3
- data/lib/theme_check/storage.rb +3 -3
- data/lib/theme_check/string_helpers.rb +47 -0
- data/lib/theme_check/tags.rb +1 -2
- data/lib/theme_check/theme.rb +1 -1
- data/lib/theme_check/version.rb +1 -1
- data/packaging/homebrew/theme_check.base.rb +1 -1
- data/theme-check.gemspec +1 -2
- metadata +16 -18
@@ -10,17 +10,19 @@ module ThemeCheck
|
|
10
10
|
all.fetch(filter, nil)
|
11
11
|
end
|
12
12
|
|
13
|
+
def labels
|
14
|
+
@labels ||= all.keys
|
15
|
+
end
|
16
|
+
|
13
17
|
private
|
14
18
|
|
15
19
|
def all
|
16
|
-
@all ||=
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|
20
|
+
@all ||= YAML.load(File.read("#{__dir__}/../../../data/shopify_liquid/deprecated_filters.yml"))
|
21
|
+
.values
|
22
|
+
.each_with_object({}) do |filters, acc|
|
23
|
+
filters.each do |(filter, alternatives)|
|
24
|
+
acc[filter] = alternatives
|
25
|
+
end
|
24
26
|
end
|
25
27
|
end
|
26
28
|
end
|
@@ -7,11 +7,9 @@ module ThemeCheck
|
|
7
7
|
extend self
|
8
8
|
|
9
9
|
def labels
|
10
|
-
@labels ||=
|
11
|
-
|
12
|
-
|
13
|
-
.flatten
|
14
|
-
end
|
10
|
+
@labels ||= YAML.load(File.read("#{__dir__}/../../../data/shopify_liquid/filters.yml"))
|
11
|
+
.values
|
12
|
+
.flatten
|
15
13
|
end
|
16
14
|
end
|
17
15
|
end
|
@@ -7,15 +7,11 @@ module ThemeCheck
|
|
7
7
|
extend self
|
8
8
|
|
9
9
|
def labels
|
10
|
-
@labels ||=
|
11
|
-
YAML.load(File.read("#{__dir__}/../../../data/shopify_liquid/objects.yml"))
|
12
|
-
end
|
10
|
+
@labels ||= YAML.load(File.read("#{__dir__}/../../../data/shopify_liquid/objects.yml"))
|
13
11
|
end
|
14
12
|
|
15
13
|
def plus_labels
|
16
|
-
@plus_labels ||=
|
17
|
-
YAML.load(File.read("#{__dir__}/../../../data/shopify_liquid/plus_objects.yml"))
|
18
|
-
end
|
14
|
+
@plus_labels ||= YAML.load(File.read("#{__dir__}/../../../data/shopify_liquid/plus_objects.yml"))
|
19
15
|
end
|
20
16
|
end
|
21
17
|
end
|
data/lib/theme_check/storage.rb
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
|
3
3
|
module ThemeCheck
|
4
4
|
class Storage
|
5
|
-
def
|
5
|
+
def path(relative_path)
|
6
6
|
raise NotImplementedError
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
9
|
+
def read(relative_path)
|
10
10
|
raise NotImplementedError
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
13
|
+
def write(relative_path, content)
|
14
14
|
raise NotImplementedError
|
15
15
|
end
|
16
16
|
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ThemeCheck
|
4
|
+
module StringHelpers
|
5
|
+
extend self
|
6
|
+
|
7
|
+
# Removes the module part from the expression in the string.
|
8
|
+
# Ported from ActiveSupport
|
9
|
+
#
|
10
|
+
# demodulize('ActiveSupport::Inflector::Inflections') # => "Inflections"
|
11
|
+
# demodulize('Inflections') # => "Inflections"
|
12
|
+
# demodulize('::Inflections') # => "Inflections"
|
13
|
+
# demodulize('') # => ""
|
14
|
+
#
|
15
|
+
# See also #deconstantize.
|
16
|
+
def demodulize(path)
|
17
|
+
path = path.to_s
|
18
|
+
if (i = path.rindex("::"))
|
19
|
+
path[(i + 2)..-1]
|
20
|
+
else
|
21
|
+
path
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# Makes an underscored, lowercase form from the expression in the string.
|
26
|
+
# Base on ActiveSupport's
|
27
|
+
#
|
28
|
+
# Changes '::' to '/' to convert namespaces to paths.
|
29
|
+
#
|
30
|
+
# underscore('ActiveModel') # => "active_model"
|
31
|
+
# underscore('ActiveModel::Errors') # => "active_model/errors"
|
32
|
+
#
|
33
|
+
# As a rule of thumb you can think of +underscore+ as the inverse of
|
34
|
+
# #camelize, though there are cases where that does not hold:
|
35
|
+
#
|
36
|
+
# camelize(underscore('SSLError')) # => "SslError"
|
37
|
+
def underscore(camel_cased_word)
|
38
|
+
return camel_cased_word unless /[A-Z-]|::/.match?(camel_cased_word)
|
39
|
+
word = camel_cased_word.to_s.gsub("::", "/")
|
40
|
+
word.gsub!(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2')
|
41
|
+
word.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
|
42
|
+
word.tr!("-", "_")
|
43
|
+
word.downcase!
|
44
|
+
word
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/lib/theme_check/tags.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require "active_support/core_ext/string/starts_ends_with"
|
3
2
|
|
4
3
|
module ThemeCheck
|
5
4
|
module Tags
|
@@ -19,7 +18,7 @@ module ThemeCheck
|
|
19
18
|
"Error in tag 'section' - Valid syntax: section '[type]'",
|
20
19
|
) unless match
|
21
20
|
@section_name = match[:section_name].tr(%('"), '')
|
22
|
-
@section_name.chomp!(".liquid") if @section_name.
|
21
|
+
@section_name.chomp!(".liquid") if @section_name.end_with?(".liquid")
|
23
22
|
end
|
24
23
|
end
|
25
24
|
|
data/lib/theme_check/theme.rb
CHANGED
data/lib/theme_check/version.rb
CHANGED
@@ -13,7 +13,7 @@ class ThemeCheck < Formula
|
|
13
13
|
class RubyGemsDownloadStrategy < AbstractDownloadStrategy
|
14
14
|
include RubyBin
|
15
15
|
|
16
|
-
def fetch
|
16
|
+
def fetch(_timeout: nil, **_options)
|
17
17
|
ohai("Fetching theme-check from gem source")
|
18
18
|
cache.cd do
|
19
19
|
ENV['GEM_SPEC_CACHE'] = "#{cache}/gem_spec_cache"
|
data/theme-check.gemspec
CHANGED
@@ -22,7 +22,6 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
|
25
|
-
spec.add_dependency('liquid', '>= 5')
|
26
|
-
spec.add_dependency('activesupport')
|
25
|
+
spec.add_dependency('liquid', '>= 5.0.1')
|
27
26
|
spec.add_dependency('nokogumbo')
|
28
27
|
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.
|
4
|
+
version: 0.7.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-
|
11
|
+
date: 2021-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: liquid
|
@@ -16,28 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 5.0.1
|
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:
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: activesupport
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
26
|
+
version: 5.0.1
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: nokogumbo
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,12 +67,15 @@ files:
|
|
81
67
|
- data/shopify_liquid/objects.yml
|
82
68
|
- data/shopify_liquid/plus_objects.yml
|
83
69
|
- data/shopify_liquid/tags.yml
|
70
|
+
- data/shopify_translation_keys.yml
|
84
71
|
- dev.yml
|
85
72
|
- docs/checks/CHECK_DOCS_TEMPLATE.md
|
73
|
+
- docs/checks/asset_size_css.md
|
86
74
|
- docs/checks/asset_size_javascript.md
|
87
75
|
- docs/checks/convert_include_to_render.md
|
88
76
|
- docs/checks/default_locale.md
|
89
77
|
- docs/checks/deprecated_filter.md
|
78
|
+
- docs/checks/img_width_and_height.md
|
90
79
|
- docs/checks/liquid_tag.md
|
91
80
|
- docs/checks/matching_schema_translations.md
|
92
81
|
- docs/checks/matching_translations.md
|
@@ -95,6 +84,7 @@ files:
|
|
95
84
|
- docs/checks/missing_template.md
|
96
85
|
- docs/checks/nested_snippet.md
|
97
86
|
- docs/checks/parser_blocking_javascript.md
|
87
|
+
- docs/checks/remote_asset.md
|
98
88
|
- docs/checks/required_directories.md
|
99
89
|
- docs/checks/required_layout_theme_object.md
|
100
90
|
- docs/checks/space_inside_braces.md
|
@@ -116,10 +106,12 @@ files:
|
|
116
106
|
- lib/theme_check/asset_file.rb
|
117
107
|
- lib/theme_check/check.rb
|
118
108
|
- lib/theme_check/checks.rb
|
109
|
+
- lib/theme_check/checks/asset_size_css.rb
|
119
110
|
- lib/theme_check/checks/asset_size_javascript.rb
|
120
111
|
- lib/theme_check/checks/convert_include_to_render.rb
|
121
112
|
- lib/theme_check/checks/default_locale.rb
|
122
113
|
- lib/theme_check/checks/deprecated_filter.rb
|
114
|
+
- lib/theme_check/checks/img_width_and_height.rb
|
123
115
|
- lib/theme_check/checks/liquid_tag.rb
|
124
116
|
- lib/theme_check/checks/matching_schema_translations.rb
|
125
117
|
- lib/theme_check/checks/matching_translations.rb
|
@@ -128,6 +120,7 @@ files:
|
|
128
120
|
- lib/theme_check/checks/missing_template.rb
|
129
121
|
- lib/theme_check/checks/nested_snippet.rb
|
130
122
|
- lib/theme_check/checks/parser_blocking_javascript.rb
|
123
|
+
- lib/theme_check/checks/remote_asset.rb
|
131
124
|
- lib/theme_check/checks/required_directories.rb
|
132
125
|
- lib/theme_check/checks/required_layout_theme_object.rb
|
133
126
|
- lib/theme_check/checks/space_inside_braces.rb
|
@@ -157,7 +150,10 @@ files:
|
|
157
150
|
- lib/theme_check/language_server/completion_provider.rb
|
158
151
|
- lib/theme_check/language_server/completion_providers/filter_completion_provider.rb
|
159
152
|
- lib/theme_check/language_server/completion_providers/object_completion_provider.rb
|
153
|
+
- lib/theme_check/language_server/completion_providers/render_snippet_completion_provider.rb
|
160
154
|
- lib/theme_check/language_server/completion_providers/tag_completion_provider.rb
|
155
|
+
- lib/theme_check/language_server/constants.rb
|
156
|
+
- lib/theme_check/language_server/document_link_engine.rb
|
161
157
|
- lib/theme_check/language_server/handler.rb
|
162
158
|
- lib/theme_check/language_server/position_helper.rb
|
163
159
|
- lib/theme_check/language_server/protocol.rb
|
@@ -171,6 +167,7 @@ files:
|
|
171
167
|
- lib/theme_check/parsing_helpers.rb
|
172
168
|
- lib/theme_check/printer.rb
|
173
169
|
- lib/theme_check/regex_helpers.rb
|
170
|
+
- lib/theme_check/releaser.rb
|
174
171
|
- lib/theme_check/remote_asset_file.rb
|
175
172
|
- lib/theme_check/shopify_liquid.rb
|
176
173
|
- lib/theme_check/shopify_liquid/deprecated_filter.rb
|
@@ -178,6 +175,7 @@ files:
|
|
178
175
|
- lib/theme_check/shopify_liquid/object.rb
|
179
176
|
- lib/theme_check/shopify_liquid/tag.rb
|
180
177
|
- lib/theme_check/storage.rb
|
178
|
+
- lib/theme_check/string_helpers.rb
|
181
179
|
- lib/theme_check/tags.rb
|
182
180
|
- lib/theme_check/template.rb
|
183
181
|
- lib/theme_check/theme.rb
|