diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index a647781e5ecdc..387ce048c4b88 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1831,6 +1831,9 @@ def _test_indent(txt: str): # Ignore blank lines continue + if strip is not None: + line = line.strip(strip) + if regex: # check for regex if not re.match(regex, line): @@ -1839,9 +1842,6 @@ def _test_indent(txt: str): if _test_indent(line): continue - if strip is not None: - line = line.strip(strip) - if fold: # Fold back indented lines after the current one for cont in takewhile(_test_indent, lines[idx + 1:]): @@ -1865,8 +1865,8 @@ def check_file(self, file, fp): start_marker = f"{self.MARKER}-start" stop_marker = f"{self.MARKER}-stop" - regex_marker = r"re\((.+)\)" - strip_marker = r"strip\((.+)\)" + regex_marker = r"re\(([^)]+)\)" + strip_marker = r"strip\(([^)]+)\)" nofold_marker = "nofold" start_line = 0 regex = None