You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
However, the second case fails even though the regex is the same. Both pass when I replace (?P<severity>.*) with (?P<severity>[^:]+). Arguably the pattern should be tightened further, the severity is always expressed using ASCII letters only, for example.
I'll create a PR for this.
mjpieters
added a commit
to mjpieters/pytest-mypy-plugins
that referenced
this issue
Dec 20, 2024
The `severity` group was permissive enough to also capture parts of
the message text if that contained any colons. Update it to only capture
(ASCII) words, and update preceding groups to match at least 1
character.
Fixestypeddjango#155
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:Given a typical input with type annotations in a function:
the
severity
group captures the textnote: Revealed type is def(foo
.With more colons, the group ever expands; given
the
severity
group matchesnote: 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.
The text was updated successfully, but these errors were encountered: