Use a better python problem matcher #420
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
The old matcher only worked if the error was raised with
raise Exception('single quotes')
.This represents a miniscule fraction of errors; for instance,
l[37]
on a short listl
can raiseIndexError
, and any call to a builtin C function is not going to trace back to araise
call.Instead, this just matches the first line without fail that comes after the context line.
Note that this is still not foolproof; in Python 3.10,
SyntaxError
s are produced asThis matcher will incorrectly pick up
^^^^^^^^^^^^^^^^^^^^
as the error message, but the previous behavior was to not pick up any error message at all.As far as I can tell, this is impossible to handle correctly; the grammar of problem matchers is far too limiting.
Some other changes:
"
."
is not a regex character, it needs only to be escaped once for JSONraise
(common) and catching errors which are printed by a custom handler (uncommon).Related issue:
This follows on from
Check list:
There are no existing tests for this feature, nor do I know if it is even possible to test.
However, I tested this matcher in another action at https://github.com/sigproc-classrooms/sf2_competition_template/runs/6746359679?check_suite_focus=true#step:6:38, where you can see that it has correctly found an error that would not have previously matched.