Skip to content

Commit 5d79c08

Browse files
html_validation: sort errors by line before exit
Change-Id: I9171ef8813fb14745fe7ea3ecf110cc81a381eb1
1 parent 4364cf4 commit 5d79c08

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

scripts/html_validation/lib/tag_balance.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ def __exit__(
7979
}
8080
for tag, line, attrs in self._stack
8181
)
82+
self._errors.sort(key=lambda item: item["line"])
8283
self._stack = []
8384
self.close()
8485

scripts/html_validation/tests/test_tag_balance.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,6 @@ def test_check_html_tag_balance_error_payload() -> None:
8888
expected = {
8989
"count": 3,
9090
"errors": [
91-
{
92-
"line": 6,
93-
"reason": "has no matching open tag",
94-
"tag": "</span",
95-
},
9691
{
9792
"line": 3,
9893
"reason": "not closed before </html>",
@@ -103,6 +98,11 @@ def test_check_html_tag_balance_error_payload() -> None:
10398
"reason": "not closed before </html>",
10499
"tag": "<div class='card'>",
105100
},
101+
{
102+
"line": 6,
103+
"reason": "has no matching open tag",
104+
"tag": "</span",
105+
},
106106
],
107107
}
108108
assert value == expected

0 commit comments

Comments
 (0)