Skip to content

Commit

Permalink
Adding test and ignore for sms links (#815)
Browse files Browse the repository at this point in the history
  • Loading branch information
1beb authored Jul 12, 2024
1 parent c4c7696 commit db14667
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/djlint/rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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|/]+
- <form(?:(?!>|\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|/]+
- <form(?:(?!>|\saction=(?:\"[^\"]*\"|'[^']*')).)*?\saction=[\"|'](?!(?:https?://)|javascript:|on\w+:|mailto:|tel:)[\w|/|\s]+
- rule:
name: H019
Expand Down
5 changes: 5 additions & 0 deletions tests/test_linter/test_django_linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,11 @@
([]),
id="DJ018_data",
),
pytest.param(
('<a href="sms:?body=This%20is%20an%20sms"></a>'),
([]),
id="DJ018_data",
),
pytest.param(
('<div data-row-selection-action="highlight"></div>'),
([]),
Expand Down

0 comments on commit db14667

Please sign in to comment.