Skip to content
This repository was archived by the owner on Jul 27, 2024. It is now read-only.

Commit 3dd5d15

Browse files
authored
Fix an issue where the error message 'UndefinedObject: Undefined object section' is being incorrectly reported. (#732)
1 parent ca4d6d1 commit 3dd5d15

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

lib/theme_check/shopify_liquid/source_index.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def objects
2222
load_file(:objects)
2323
.concat(built_in_objects)
2424
.filter_map do |hash|
25-
next if (theme_app_extension_labels + labels_only_exposed_in_certain_contexts).include?(hash['name'])
25+
next if labels_only_exposed_in_certain_contexts.include?(hash['name'])
2626

2727
ObjectEntry.new(hash)
2828
end
@@ -45,7 +45,7 @@ def theme_app_extension_labels
4545
end
4646

4747
def labels_only_exposed_in_certain_contexts
48-
['robots'].freeze
48+
['robots', 'app'].freeze
4949
end
5050

5151
def deprecated_filters

test/checks/undefined_object_test.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,16 @@ def test_report_on_app_liquid_drop_in_themes
450450
END
451451
end
452452

453+
def test_does_not_report_when_section_is_used
454+
offenses = analyze_theme(
455+
ThemeCheck::UndefinedObject.new(exclude_snippets: false),
456+
"blocks/block_a.liquid" => <<~END,
457+
<p>{{ section.id }}</p>
458+
END
459+
)
460+
assert_offenses("", offenses)
461+
end
462+
453463
def test_does_not_report_on_app_liquid_drop_in_theme_app_extensions
454464
offenses = analyze_theme(
455465
ThemeCheck::UndefinedObject.new(exclude_snippets: false, config_type: :theme_app_extension),

0 commit comments

Comments
 (0)