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):