From 15f0817d5458e528fa8547c92e0ab4dcb33faf90 Mon Sep 17 00:00:00 2001 From: JWM Date: Tue, 23 Sep 2025 17:33:00 +0200 Subject: [PATCH] Remove ANSI color escape codes from content --- src/mlx/warnings/regex_checker.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mlx/warnings/regex_checker.py b/src/mlx/warnings/regex_checker.py index 01ffc95..884df17 100644 --- a/src/mlx/warnings/regex_checker.py +++ b/src/mlx/warnings/regex_checker.py @@ -18,6 +18,8 @@ COVERITY_WARNING_REGEX = r"(?P[\w\.\\/\- ]+)(:(?P\d+)(:(?P\d+))?)?: ?CID (?P\d+) \(#(?P\d+) of (?P\d+)\): (?P.+): (?P[\w ]+),.+" coverity_pattern = re.compile(COVERITY_WARNING_REGEX) +ANSI_ESCAPE_REGEX = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])') + class RegexChecker(WarningsChecker): name = "regex" @@ -39,7 +41,8 @@ def check(self, content): Args: content (str): The content to parse """ - matches = re.finditer(self.pattern, content) + clean_content = ANSI_ESCAPE_REGEX.sub('', content) + matches = re.finditer(self.pattern, clean_content) for match in matches: match_string = match.group(0).strip() if self._is_excluded(match_string):