Skip to content

Commit

Permalink
Extract Fatal PHP error (from phpunit log)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdeweerd committed Mar 18, 2024
1 parent 43640ce commit 09fb4c6
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
run: |
python ${LOG_TO_CS} ${RAW_LOG} ${CS_XML}
- name: Convert Raw Log to Checkstyle format (launch action)
uses: mdeweerd/logToCheckStyle@v2024.3.1
uses: mdeweerd/.3.2
if: ${{ failure() }}
with:
in: ${{ env.RAW_LOG }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ optional arguments:
```yaml
- name: Convert Raw Log to Checkstyle format (launch action)
uses: mdeweerd/logToCheckStyle@v2024.3.1
uses: mdeweerd/.3.2
if: ${{ failure() }}
with:
in: ${{ env.RAW_LOG }}
Expand Down
8 changes: 8 additions & 0 deletions logToCs.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,14 @@ def submit( # pylint: disable=too-many-arguments
# Phan:
# path\to\file.php:379 PhanKey Message...
re.compile(f"^{FILE_REGEX}:{LINE_REGEX} {MSG_REGEX}$"),
# PHP Fatal error (in phpunit) (single line):
# PHP Fatal error: Message in path/to/file on line 91
# Or:
# Fatal error: Message in path/to/file on line 91
re.compile(
rf"^(?:PHP )Fatal error:{MSG_REGEX}"
rf" in {FILE_REGEX} on line {LINE_REGEX}$"
),
]

# Exceptionnaly some regexes match messages that are not error.
Expand Down
4 changes: 4 additions & 0 deletions tests/IN/phpunit_phpfatal.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PHP Fatal error: Declaration of InterfaceLogevents::runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) must be compatible with DolibarrTriggers::runTrigger($action, $object, User $user, Translate $langs, Conf $conf) in D:\project\core\triggers\interface_20_all_Logevents.class.php on line 91
UserTest::testUserCreate USER_PASSWORD_GENERATED=Standard

Fatal error: Declaration of InterfaceLogevents::runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) must be compatible with DolibarrTriggers::runTrigger($action, $object, User $user, Translate $langs, Conf $conf) in D:\project\core\triggers\interface_20_all_Logevents.class.php on line 91
1 change: 1 addition & 0 deletions tests/IN/phpunit_phpfatal.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::error file=D%3A/project/core/triggers/interface_20_all_Logevents.class.php,line=91::Declaration of InterfaceLogevents::runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) must be compatible with DolibarrTriggers::runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
2 changes: 2 additions & 0 deletions tests/IN/phpunit_phpfatal.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='utf_8'?>
<checkstyle version="6.5"><file name="D:\project\core\triggers\interface_20_all_Logevents.class.php"><error severity="error" line="91" message="Declaration of InterfaceLogevents::runTrigger(string $action, $object, User $user, Translate $langs, Conf $conf) must be compatible with DolibarrTriggers::runTrigger($action, $object, User $user, Translate $langs, Conf $conf)" /></file></checkstyle>

0 comments on commit 09fb4c6

Please sign in to comment.