From db146679aa978b8cb6e8d8159b73b66a6760847a Mon Sep 17 00:00:00 2001 From: Brandon Bertelsen Date: Fri, 12 Jul 2024 09:17:49 -0400 Subject: [PATCH] Adding test and ignore for sms links (#815) --- src/djlint/rules.yaml | 4 ++-- tests/test_linter/test_django_linter.py | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/djlint/rules.yaml b/src/djlint/rules.yaml index 6b40c7793..96b288cc7 100644 --- a/src/djlint/rules.yaml +++ b/src/djlint/rules.yaml @@ -127,14 +127,14 @@ message: (Django) Internal links should use the {% url ... %} pattern. flags: re.DOTALL|re.I patterns: - - <(?:a|div|span|input)\b[^>]*?\s(?:href|data-url|data-src|action)=[\"|'](?!(?:https?://)|javascript:|on\w+:|mailto:|tel:|data:)[\w|/]+ + - <(?:a|div|span|input)\b[^>]*?\s(?:href|data-url|data-src|action)=[\"|'](?!(?:https?://)|javascript:|on\w+:|mailto:|tel:|data:|sms:)[\w|/]+ - |\saction=(?:\"[^\"]*\"|'[^']*')).)*?\saction=[\"|'](?!(?:https?://)|javascript:|on\w+:|mailto:|tel:)[\w|/|\s]+ - rule: name: J018 message: (Jinja) Internal links should use the {{ url_for() ... }} pattern. flags: re.DOTALL|re.I patterns: - - <(?:a|div|span|input)\b[^>]*?\s(?:href|data-url|data-src|action)=[\"|'](?!(?:https?://)|javascript:|on\w+:|mailto:|tel:|data:)[\w|/]+ + - <(?:a|div|span|input)\b[^>]*?\s(?:href|data-url|data-src|action)=[\"|'](?!(?:https?://)|javascript:|on\w+:|mailto:|tel:|data:|sms:)[\w|/]+ - |\saction=(?:\"[^\"]*\"|'[^']*')).)*?\saction=[\"|'](?!(?:https?://)|javascript:|on\w+:|mailto:|tel:)[\w|/|\s]+ - rule: name: H019 diff --git a/tests/test_linter/test_django_linter.py b/tests/test_linter/test_django_linter.py index cbc76d8eb..61e08406d 100644 --- a/tests/test_linter/test_django_linter.py +++ b/tests/test_linter/test_django_linter.py @@ -269,6 +269,11 @@ ([]), id="DJ018_data", ), + pytest.param( + (''), + ([]), + id="DJ018_data", + ), pytest.param( ('
'), ([]),