fixed rule E001 for handlbars

This commit is contained in:
Christopher Pickering 2021-08-17 10:00:56 -05:00
parent 41e95ce63b
commit 4f38370225
No known key found for this signature in database
GPG key ID: E14DB3B0A0FACF84
3 changed files with 12 additions and 2 deletions

View file

@ -298,10 +298,12 @@ def main(
for error in file_errors:
error_count += build_output(error)
success_message = "%sed %s, found %d errors." % (
error_case = "error" if error_count == 1 else "errors"
success_message = "%sed %s, found %d %s." % (
message,
file_quantity,
error_count,
error_case,
)
success_color = Fore.RED + Style.BRIGHT if error_count > 0 else Fore.BLUE

View file

@ -11,7 +11,7 @@
- '[^{]{\/[^\s]+|^{\/[^\s]+'
- '[^{]{\@[^\s]+|^{\@[^\s]+'
# close
- '[^\s]+[}|%|#]}'
- '[^(\s|^)]+[}|%|#]}'
- \s{2,}[}|%|#]}
- '{[{|%|#]\s{2,}'
- rule:

View file

@ -119,6 +119,7 @@ def test_W006(runner, tmp_file):
result = runner.invoke(djlint, [tmp_file.name])
assert result.exit_code == 0
assert "W006 1:" in result.output
assert "a" == "b"
def test_W007(runner, tmp_file):
@ -211,6 +212,13 @@ def test_W018(runner, tmp_file):
assert "W018 1:" in result.output
def test_handlebars_else(runner, tmp_file):
write_to_file(tmp_file.name, b"{{^}}")
result = runner.invoke(djlint, [tmp_file.name])
assert result.exit_code == 0
assert "Linted 1 file, found 0 errors." in result.output
# assert "asdf" in result.output