Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use colon in output lines because item parsing is too greedy #155

Open
mjpieters opened this issue Dec 16, 2024 · 0 comments
Open

Comments

@mjpieters
Copy link

mjpieters commented Dec 16, 2024

The way that out lines are matched is not allowing for colons in the output message, because the severity group can capture up to the last colon in the message:

r"^(?P<fname>.*):(?P<lnum>\d*): (?P<severity>.*):((?P<col>\d+):)? (?P<message>.*)$"

Given a typical input with type annotations in a function:

main:2: note: Revealed type is def(foo: str) -> int

the severity group captures the text note: Revealed type is def(foo.

With more colons, the group ever expands; given

main:2: note: Revealed type is def(foo: str, bar: int, baz: float) -> int

the severity group matches note: Revealed type is def(foo: str, bar: int, baz.

See https://regex101.com/r/wOwuXG/1 for how the groups are filled.

Please match only non-colon text for severity:

(?P<severity>[^:]*)

to prevent this. See https://regex101.com/r/sM2uam/1 for a demo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant