Skip to content

Commit

Permalink
Merge pull request Shopify#350 from Shopify/fix-empty-markup-in-Space…
Browse files Browse the repository at this point in the history
…InsideBraces

Ignore empty `{{}}` in `SpaceInsideBraces`
  • Loading branch information
macournoyer authored Jul 6, 2021
2 parents 14fef94 + f843c00 commit 11ce290
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/theme_check/checks/space_inside_braces.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def after_tag(_node)
end

def on_variable(node)
return if @ignore
return if @ignore || node.markup.empty?
if node.markup[0] != " "
add_offense("Space missing after '{{'", node: node) do |corrector|
corrector.insert_before(node, " ")
Expand Down
10 changes: 10 additions & 0 deletions test/checks/space_inside_braces_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -293,4 +293,14 @@ def test_dont_report_missing_spaces_inside_strings
)
assert_offenses('', offenses)
end

def test_dont_report_empty_variables
offenses = analyze_theme(
ThemeCheck::SpaceInsideBraces.new,
"templates/index.liquid" => <<~END,
{{}}
END
)
assert_offenses('', offenses)
end
end

0 comments on commit 11ce290

Please sign in to comment.