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

Commit

Permalink
Ignore empty {{}} in SpaceInsideBraces
Browse files Browse the repository at this point in the history
Fixes #348
  • Loading branch information
macournoyer committed Jul 6, 2021
1 parent 14fef94 commit f843c00
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 f843c00

Please sign in to comment.