mirror of
https://github.com/Hopiu/djLint.git
synced 2026-04-29 01:14:44 +00:00
updated regex to require a tag name before looking for attribute =. Closes #46
This commit is contained in:
parent
9ab51a115a
commit
d01f866a29
2 changed files with 12 additions and 3 deletions
|
|
@ -215,8 +215,8 @@
|
|||
message: There should be no spaces around attribute =.
|
||||
flags: re.DOTALL
|
||||
patterns:
|
||||
- <(?:(?!\{[%|{|#])[^\n|>])*\s+=
|
||||
- <(?:(?!\{[%|{|#])[^\n|>])*=\s
|
||||
- <\w+?(?:(?!\{[%|{|#])[^\n|>])*\s+=
|
||||
- <\w+?(?:(?!\{[%|{|#])[^\n|>])*=\s
|
||||
- rule:
|
||||
name: H014
|
||||
message: More than 2 blank lines.
|
||||
|
|
|
|||
|
|
@ -140,12 +140,21 @@ def test_H012(runner: CliRunner, tmp_file: TextIO) -> None:
|
|||
assert result.exit_code == 1
|
||||
assert "H012 1:" in result.output
|
||||
|
||||
# test for not matching random "="" in text
|
||||
# test for not matching random "=" in text
|
||||
write_to_file(tmp_file.name, b"<h3>#= title #</h3>")
|
||||
result = runner.invoke(djlint, [tmp_file.name])
|
||||
assert result.exit_code == 0
|
||||
assert "H012 1:" not in result.output
|
||||
|
||||
# test for not matching "=" in template condition
|
||||
write_to_file(
|
||||
tmp_file.name,
|
||||
b"<p>{% if activity.reporting_groups|length <= 0 %}<h3>{% trans 'General' %}</h3>{% endif %}</p>",
|
||||
)
|
||||
result = runner.invoke(djlint, [tmp_file.name])
|
||||
assert result.exit_code == 0
|
||||
assert "H012 1:" not in result.output
|
||||
|
||||
|
||||
def test_H014(runner: CliRunner, tmp_file: TextIO) -> None:
|
||||
write_to_file(tmp_file.name, b"</div>\n\n\n<p>")
|
||||
|
|
|
|||
Loading…
Reference in a new issue