platformos-check 0.4.14 → 0.5.0
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/CHANGELOG.md +6 -0
- data/CONTRIBUTING.md +20 -7
- data/RELEASING.md +1 -1
- data/TROUBLESHOOTING.md +2 -2
- data/data/platformos_liquid/documentation/filters.json +1 -1
- data/data/platformos_liquid/documentation/latest.json +1 -1
- data/lib/platformos_check/analyzer.rb +34 -38
- data/lib/platformos_check/disabled_checks.rb +1 -1
- data/lib/platformos_check/language_server/variable_lookup_finder/tolerant_parser.rb +11 -35
- data/lib/platformos_check/tags/rollback.rb +8 -0
- data/lib/platformos_check/tags/transaction.rb +8 -0
- data/lib/platformos_check/tags.rb +20 -20
- data/lib/platformos_check/version.rb +1 -1
- data/lib/platformos_check.rb +2 -13
- data/platformos-check.gemspec +1 -1
- metadata +7 -9
@@ -1,2 +1,2 @@
|
|
1
1
|
|
2
|
-
{"revision":"
|
2
|
+
{"revision":"1a08535d872a31f9df129d72df20919ca47309a6"}
|
@@ -53,13 +53,11 @@ module PlatformosCheck
|
|
53
53
|
liquid_visitor = LiquidVisitor.new(@liquid_checks, @disabled_checks)
|
54
54
|
html_visitor = HtmlVisitor.new(@html_checks)
|
55
55
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
@warnings[liquid_file.path] = liquid_file.warnings if @store_warnings && !liquid_file.warnings&.empty?
|
62
|
-
end
|
56
|
+
@platformos_app.liquid.each_with_index do |liquid_file, i|
|
57
|
+
yield(liquid_file.relative_path.to_s, i, total_file_count) if block_given?
|
58
|
+
liquid_visitor.visit_liquid_file(liquid_file)
|
59
|
+
html_visitor.visit_liquid_file(liquid_file)
|
60
|
+
@warnings[liquid_file.path] = liquid_file.warnings if @store_warnings && !liquid_file.warnings&.empty?
|
63
61
|
end
|
64
62
|
|
65
63
|
@platformos_app.yaml.each_with_index do |yaml_file, i|
|
@@ -87,39 +85,37 @@ module PlatformosCheck
|
|
87
85
|
def analyze_files(files, only_single_file: false)
|
88
86
|
reset
|
89
87
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
html_visitor.visit_liquid_file(liquid_file)
|
104
|
-
end
|
105
|
-
|
106
|
-
@platformos_app.yaml.each_with_index do |yaml_file, i|
|
107
|
-
yield(yaml_file.relative_path.to_s, liquid_file_count + i, total) if block_given?
|
108
|
-
@yaml_checks.whole_platformos_app.call(:on_file, yaml_file)
|
109
|
-
end
|
88
|
+
total = files.size
|
89
|
+
offset = 0
|
90
|
+
|
91
|
+
unless only_single_file
|
92
|
+
# Call all checks that run on the whole platformos_app
|
93
|
+
liquid_visitor = LiquidVisitor.new(@liquid_checks.whole_platformos_app, @disabled_checks)
|
94
|
+
html_visitor = HtmlVisitor.new(@html_checks.whole_platformos_app)
|
95
|
+
total += total_file_count
|
96
|
+
offset = total_file_count
|
97
|
+
@platformos_app.liquid.each_with_index do |liquid_file, i|
|
98
|
+
yield(liquid_file.relative_path.to_s, i, total) if block_given?
|
99
|
+
liquid_visitor.visit_liquid_file(liquid_file)
|
100
|
+
html_visitor.visit_liquid_file(liquid_file)
|
110
101
|
end
|
111
102
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
103
|
+
@platformos_app.yaml.each_with_index do |yaml_file, i|
|
104
|
+
yield(yaml_file.relative_path.to_s, liquid_file_count + i, total) if block_given?
|
105
|
+
@yaml_checks.whole_platformos_app.call(:on_file, yaml_file)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
# Call checks that run on a single files, only on specified file
|
110
|
+
liquid_visitor = LiquidVisitor.new(@liquid_checks.single_file, @disabled_checks, only_single_file:)
|
111
|
+
html_visitor = HtmlVisitor.new(@html_checks.single_file)
|
112
|
+
files.each_with_index do |app_file, i|
|
113
|
+
yield(app_file.relative_path.to_s, offset + i, total) if block_given?
|
114
|
+
if app_file.liquid?
|
115
|
+
liquid_visitor.visit_liquid_file(app_file)
|
116
|
+
html_visitor.visit_liquid_file(app_file)
|
117
|
+
elsif app_file.yaml?
|
118
|
+
@yaml_checks.single_file.call(:on_file, app_file)
|
123
119
|
end
|
124
120
|
end
|
125
121
|
|
@@ -11,34 +11,25 @@ module PlatformosCheck
|
|
11
11
|
# The tolerant parser relies on a tolerant custom parse
|
12
12
|
# context to creates a new 'Template' object, even when
|
13
13
|
# a block is not closed.
|
14
|
-
Liquid::Template.parse(content,
|
14
|
+
Liquid::Template.parse(content, environment: environment)
|
15
15
|
end
|
16
16
|
|
17
17
|
private
|
18
18
|
|
19
|
-
def
|
20
|
-
|
19
|
+
def environment
|
20
|
+
@environment ||= Liquid::Environment.build(tags: Liquid::Environment.default.tags.merge(
|
21
|
+
{
|
22
|
+
'case' => Tags::Case,
|
23
|
+
'for' => Tags::For,
|
24
|
+
'if' => Tags::If,
|
25
|
+
'tablerow' => Tags::TableRow,
|
26
|
+
'unless' => Tags::Unless
|
27
|
+
}
|
28
|
+
))
|
21
29
|
end
|
22
30
|
end
|
23
31
|
end
|
24
32
|
|
25
|
-
class ParseContext < Liquid::ParseContext
|
26
|
-
def new_block_body
|
27
|
-
BlockBody.new
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
class BlockBody < Liquid::BlockBody
|
32
|
-
##
|
33
|
-
# The tags are statically defined and referenced at the
|
34
|
-
# 'Liquid::Template', so the TolerantParser just uses the
|
35
|
-
# redefined tags at this custom block body. Thus, there's
|
36
|
-
# no side-effects between the regular and the tolerant parsers.
|
37
|
-
def registered_tags
|
38
|
-
Tags.new(super)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
33
|
class Tags
|
43
34
|
module TolerantBlockBody
|
44
35
|
##
|
@@ -72,21 +63,6 @@ module PlatformosCheck
|
|
72
63
|
class Unless < Liquid::Unless
|
73
64
|
include TolerantBlockBody
|
74
65
|
end
|
75
|
-
|
76
|
-
def initialize(standard_tags)
|
77
|
-
@standard_tags = standard_tags
|
78
|
-
@tolerant_tags = {
|
79
|
-
'case' => Case,
|
80
|
-
'for' => For,
|
81
|
-
'if' => If,
|
82
|
-
'tablerow' => TableRow,
|
83
|
-
'unless' => Unless
|
84
|
-
}
|
85
|
-
end
|
86
|
-
|
87
|
-
def [](key)
|
88
|
-
@tolerant_tags[key] || @standard_tags[key]
|
89
|
-
end
|
90
66
|
end
|
91
67
|
end
|
92
68
|
end
|
@@ -2,8 +2,6 @@
|
|
2
2
|
|
3
3
|
module PlatformosCheck
|
4
4
|
module Tags
|
5
|
-
# Copied tags parsing code from storefront-renderer
|
6
|
-
|
7
5
|
class ContentFor < BaseBlock; end
|
8
6
|
|
9
7
|
class Yield < Base; end
|
@@ -26,40 +24,42 @@ module PlatformosCheck
|
|
26
24
|
end
|
27
25
|
|
28
26
|
def register_tag(name, klass)
|
29
|
-
Liquid::
|
27
|
+
Liquid::Environment.default.register_tag(name, klass)
|
30
28
|
end
|
31
29
|
|
32
30
|
def register_tags!
|
33
31
|
return if !register_tags? || (defined?(@registered_tags) && @registered_tags)
|
34
32
|
|
35
33
|
@registered_tags = true
|
34
|
+
register_tag('background', Background)
|
35
|
+
register_tag('cache', Cache)
|
36
|
+
register_tag('content_for', ContentFor)
|
37
|
+
register_tag('context', Context)
|
38
|
+
register_tag('context_rc', Context)
|
39
|
+
register_tag('export', Export)
|
36
40
|
register_tag('form', Form)
|
41
|
+
register_tag('function', Function)
|
42
|
+
register_tag('graphql', Graphql)
|
43
|
+
register_tag('hash_assign', HashAssign)
|
37
44
|
register_tag('include_form', IncludeForm)
|
38
|
-
register_tag('render', Render)
|
39
|
-
register_tag('theme_render', ThemeRender)
|
40
|
-
register_tag('theme_render_rc', ThemeRender)
|
41
45
|
register_tag('log', Log)
|
42
|
-
register_tag('cache', Cache)
|
43
|
-
register_tag('print', Print)
|
44
46
|
register_tag('parse_json', ParseJson)
|
45
|
-
register_tag('
|
46
|
-
register_tag('try', Try)
|
47
|
-
register_tag('export', Export)
|
48
|
-
register_tag('return', Return)
|
47
|
+
register_tag('print', Print)
|
49
48
|
register_tag('redirect_to', RedirectTo)
|
49
|
+
register_tag('render', Render)
|
50
50
|
register_tag('response_headers', ResponseHeaders)
|
51
51
|
register_tag('response_status', ResponseStatus)
|
52
|
-
register_tag('
|
53
|
-
register_tag('
|
54
|
-
register_tag('content_for', ContentFor)
|
52
|
+
register_tag('return', Return)
|
53
|
+
register_tag('rollback', Rollback)
|
55
54
|
register_tag('session', Session)
|
56
|
-
register_tag('context', Context)
|
57
|
-
register_tag('context_rc', Context)
|
58
55
|
register_tag('sign_in', SignIn)
|
59
|
-
register_tag('yield', Yield)
|
60
|
-
register_tag('graphql', Graphql)
|
61
|
-
register_tag('function', Function)
|
62
56
|
register_tag('spam_protection', SpamProtection)
|
57
|
+
register_tag('theme_render', ThemeRender)
|
58
|
+
register_tag('theme_render_rc', ThemeRender)
|
59
|
+
register_tag('transaction', Transaction)
|
60
|
+
register_tag('try', Try)
|
61
|
+
register_tag('try_rc', Try)
|
62
|
+
register_tag('yield', Yield)
|
63
63
|
end
|
64
64
|
end
|
65
65
|
self.register_tags = true
|
data/lib/platformos_check.rb
CHANGED
@@ -62,10 +62,12 @@ require_relative "platformos_check/tags/render"
|
|
62
62
|
require_relative "platformos_check/tags/response_headers"
|
63
63
|
require_relative "platformos_check/tags/response_status"
|
64
64
|
require_relative "platformos_check/tags/return"
|
65
|
+
require_relative "platformos_check/tags/rollback"
|
65
66
|
require_relative "platformos_check/tags/session"
|
66
67
|
require_relative "platformos_check/tags/sign_in"
|
67
68
|
require_relative "platformos_check/tags/spam_protection"
|
68
69
|
require_relative "platformos_check/tags/theme_render"
|
70
|
+
require_relative "platformos_check/tags/transaction"
|
69
71
|
require_relative "platformos_check/tags/try"
|
70
72
|
require_relative "platformos_check/tags"
|
71
73
|
require_relative "platformos_check/liquid_node"
|
@@ -86,9 +88,6 @@ require_relative "platformos_check/language_server"
|
|
86
88
|
|
87
89
|
Dir[__dir__ + "/platformos_check/checks/*.rb"].each { |file| require file }
|
88
90
|
|
89
|
-
Encoding.default_external = Encoding::UTF_8
|
90
|
-
Encoding.default_internal = Encoding::UTF_8
|
91
|
-
|
92
91
|
module PlatformosCheck
|
93
92
|
def self.debug?
|
94
93
|
ENV["PLATFORMOS_CHECK_DEBUG"] == "true"
|
@@ -98,16 +97,6 @@ module PlatformosCheck
|
|
98
97
|
ENV.fetch("PLATFORMOS_CHECK_DEBUG_LOG_FILE", nil)
|
99
98
|
end
|
100
99
|
|
101
|
-
def self.with_liquid_c_disabled
|
102
|
-
if defined?(Liquid::C)
|
103
|
-
was_enabled = Liquid::C.enabled
|
104
|
-
Liquid::C.enabled = false if was_enabled
|
105
|
-
end
|
106
|
-
yield
|
107
|
-
ensure
|
108
|
-
Liquid::C.enabled = true if defined?(Liquid::C) && was_enabled
|
109
|
-
end
|
110
|
-
|
111
100
|
def self.log(message)
|
112
101
|
bridge = LanguageServer::Bridge.new(LanguageServer::IOMessenger.new)
|
113
102
|
bridge.log("###############\n #{message}\n##################")
|
data/platformos-check.gemspec
CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.require_paths = ["lib"]
|
29
29
|
|
30
30
|
spec.add_dependency('graphql', '~> 2.0.0')
|
31
|
-
spec.add_dependency('liquid', '5.
|
31
|
+
spec.add_dependency('liquid', '5.8.6')
|
32
32
|
spec.add_dependency('nokogiri', '>= 1.12')
|
33
33
|
spec.add_dependency('parser', '~> 3')
|
34
34
|
|
metadata
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: platformos-check
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Bliszczyk
|
8
8
|
- Dariusz Gorzęba
|
9
9
|
- Maciej Krajowski-Kukiel
|
10
|
-
autorequire:
|
11
10
|
bindir: exe
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2025-08-20 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: graphql
|
@@ -32,14 +31,14 @@ dependencies:
|
|
32
31
|
requirements:
|
33
32
|
- - '='
|
34
33
|
- !ruby/object:Gem::Version
|
35
|
-
version: 5.
|
34
|
+
version: 5.8.6
|
36
35
|
type: :runtime
|
37
36
|
prerelease: false
|
38
37
|
version_requirements: !ruby/object:Gem::Requirement
|
39
38
|
requirements:
|
40
39
|
- - '='
|
41
40
|
- !ruby/object:Gem::Version
|
42
|
-
version: 5.
|
41
|
+
version: 5.8.6
|
43
42
|
- !ruby/object:Gem::Dependency
|
44
43
|
name: nokogiri
|
45
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -68,7 +67,6 @@ dependencies:
|
|
68
67
|
- - "~>"
|
69
68
|
- !ruby/object:Gem::Version
|
70
69
|
version: '3'
|
71
|
-
description:
|
72
70
|
email:
|
73
71
|
- support@platformos.com
|
74
72
|
executables:
|
@@ -341,10 +339,12 @@ files:
|
|
341
339
|
- lib/platformos_check/tags/response_headers.rb
|
342
340
|
- lib/platformos_check/tags/response_status.rb
|
343
341
|
- lib/platformos_check/tags/return.rb
|
342
|
+
- lib/platformos_check/tags/rollback.rb
|
344
343
|
- lib/platformos_check/tags/session.rb
|
345
344
|
- lib/platformos_check/tags/sign_in.rb
|
346
345
|
- lib/platformos_check/tags/spam_protection.rb
|
347
346
|
- lib/platformos_check/tags/theme_render.rb
|
347
|
+
- lib/platformos_check/tags/transaction.rb
|
348
348
|
- lib/platformos_check/tags/try.rb
|
349
349
|
- lib/platformos_check/translation_file.rb
|
350
350
|
- lib/platformos_check/user_schema_file.rb
|
@@ -358,7 +358,6 @@ licenses:
|
|
358
358
|
metadata:
|
359
359
|
allowed_push_host: https://rubygems.org
|
360
360
|
rubygems_mfa_required: 'true'
|
361
|
-
post_install_message:
|
362
361
|
rdoc_options: []
|
363
362
|
require_paths:
|
364
363
|
- lib
|
@@ -373,8 +372,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
373
372
|
- !ruby/object:Gem::Version
|
374
373
|
version: '0'
|
375
374
|
requirements: []
|
376
|
-
rubygems_version: 3.5
|
377
|
-
signing_key:
|
375
|
+
rubygems_version: 3.6.5
|
378
376
|
specification_version: 4
|
379
377
|
summary: A platformOS App Linter
|
380
378
|
test_files: []
|