From c95574b56839f58f85399853f4cbc8cc17aec191 Mon Sep 17 00:00:00 2001 From: Christopher Pickering Date: Mon, 4 Oct 2021 10:51:54 +0200 Subject: [PATCH] updated regex for H011, closes #37 --- src/djlint/lint.py | 2 +- src/djlint/rules.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/djlint/lint.py b/src/djlint/lint.py index 85ae074..07a5afa 100644 --- a/src/djlint/lint.py +++ b/src/djlint/lint.py @@ -76,7 +76,7 @@ def lint_file(config: Config, this_file: Path) -> Dict: { "code": rule["name"], "line": get_line(match.start(), line_ends), - "match": match.group()[:20].strip(), + "match": match.group().strip()[:20], "message": rule["message"], } ) diff --git a/src/djlint/rules.yaml b/src/djlint/rules.yaml index 14eb96f..9e54514 100644 --- a/src/djlint/rules.yaml +++ b/src/djlint/rules.yaml @@ -85,9 +85,9 @@ - rule: name: H011 message: Attribute values should be quoted. - flags: re.DOTALL|re.I + flags: re.DOTALL|re.I|re.M patterns: - - "[^(?:\"|')]\\s+?(?:class|id|src|width|height|alt|style|lang|title|href|action|method)=[a-zA-Z]+" + - ^^[^(?:"|')]*?\s+?(?:class|id|src|width|height|alt|style|lang|title|href|action|method)=[a-zA-Z_-]+ - rule: name: H012 message: There should be no spaces around attribute =.