I'm writing a GitHub action that creates an annotation for files that would be reformatted when the black python formatter is run. For this, to work, I want to parse the following example output:
would reformat /home/ricks/Development/personal/errorformat/fmts/testdata/resources/python/num_guess.py
would reformat /home/ricks/Development/personal/errorformat/fmts/testdata/resources/python/subfolder/queen_problem.py
Oh no! 💥 💔 💥
2 files would be reformatted.
From this console output, I want to match the first two lines which show which files would be reformatted. I do this by using the %m %f
error format matching syntax. In addition to this, I would like to ignore the last two lies. After reading this related post I came up with the following error format syntax:
%-G%Oh no!\ %m
%-G%*\\d\ files%.%#
%m %f
%-Q
%-G%.%#
This syntax, however, doesn't seem to work as it keeps matching the last two lines as a message with a file name %m %f
. You can see this syntax in action in the following errorformat playground session.
If anybody knows the right syntax for only matching the first two lines I would be really grateful. Thanks a lot in advance!