Skip to content

Commit 4c1c606

Browse files
committed
✨ Add support for hurl error format parsing
Added new regex pattern to parse hurl error messages. The new format is: error: Error message --> api/contracts/10_contracts.hurl:3:6 Also added test files for hurl error parsing: - hurl.log: Sample hurl error log - hurl.txt: Error messages in GitHub Actions format - hurl.xml: Error messages in Checkstyle format
1 parent 3021f50 commit 4c1c606

4 files changed

Lines changed: 28 additions & 0 deletions

File tree

logToCs.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,13 @@ def submit( # pylint: disable=too-many-arguments
419419
f"^{FILE_REGEX}{EOL_REGEX}"
420420
rf"\s+{LINE_REGEX}:{COLUMN_REGEX}\s+{SEVERITY_REGEX}\s+{MSG_REGEX}$"
421421
),
422+
# hurl:
423+
# error: Error message
424+
# --> api/contracts/10_contracts.hurl:3:6
425+
re.compile(
426+
f"^error: {MSG_REGEX}{EOL_REGEX}"
427+
rf"\s+--> {FILE_REGEX}:{LINE_REGEX}:{COLUMN_REGEX}$"
428+
),
422429
# Phan:
423430
# path\to\file.php:379 PhanKey Message...
424431
re.compile(f"^{FILE_REGEX}:{LINE_REGEX} {MSG_REGEX}$"),

tests/IN/hurl.log

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
error: Assert status code
3+
--> api/status/10_status.hurl:3:6
4+
|
5+
| GET http://{{hostnport}}/api/index.php/status
6+
3 | HTTP 200
7+
| ^^^ actual value is <401>
8+
|
9+
10+
Failure api/status/10_status.hurl (1 request(s) in 75 ms)
11+
error: Assert status code
12+
--> api/emailtemplates/10_emailtemplates.hurl:3:6
13+
|
14+
| GET http://{{hostnport}}/api/index.php/emailtemplates
15+
3 | HTTP 200
16+
| ^^^ actual value is <401>
17+
|

tests/IN/hurl.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
::error file=api/status/10_status.hurl,line=3,col=6::Assert status code
2+
::error file=api/emailtemplates/10_emailtemplates.hurl,line=3,col=6::Assert status code

tests/IN/hurl.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version='1.0' encoding='utf_8'?>
2+
<checkstyle version="6.5"><file name="api/status/10_status.hurl"><error severity="error" line="3" column="6" message="Assert status code" /></file><file name="api/emailtemplates/10_emailtemplates.hurl"><error severity="error" line="3" column="6" message="Assert status code" /></file></checkstyle>

0 commit comments

Comments
 (0)