From 67602512b6cc90dad377b8b8709b981a6184fe37 Mon Sep 17 00:00:00 2001 From: Brent Westbrook <36778786+ntBre@users.noreply.github.com> Date: Thu, 20 Mar 2025 17:25:40 -0400 Subject: [PATCH] Recognize `SyntaxError:` as an error code for ecosystem checks (#16879) Summary -- This updates the regex in `ruff-ecosystem` to catch syntax errors in an effort to prevent bugs like #16874. This should catch `ParseError`s, `UnsupportedSyntaxError`s, and the upcoming `SemanticSyntaxError`s. Test Plan -- I ran the ecosystem check locally comparing v0.11.0 and v0.11.1 and saw a large number (2757!) of new syntax errors. I also manually tested the regex on a few lines before that. If we merge this before #16878, I'd expect to see that number decrease substantially in that PR too, as another test. --- python/ruff-ecosystem/ruff_ecosystem/check.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/ruff-ecosystem/ruff_ecosystem/check.py b/python/ruff-ecosystem/ruff_ecosystem/check.py index 7aa6cdda13..bf8d222125 100644 --- a/python/ruff-ecosystem/ruff_ecosystem/check.py +++ b/python/ruff-ecosystem/ruff_ecosystem/check.py @@ -45,7 +45,7 @@ CHECK_DIFF_LINE_RE = re.compile( ) CHECK_DIAGNOSTIC_LINE_RE = re.compile( - r"^(?P[+-])? ?(?P.*): (?P[A-Z]{1,4}[0-9]{3,4})(?P \[\*\])? (?P.*)" + r"^(?P[+-])? ?(?P.*): (?P[A-Z]{1,4}[0-9]{3,4}|SyntaxError:)(?P \[\*\])? (?P.*)" ) CHECK_VIOLATION_FIX_INDICATOR = " [*]"