diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 944cc8ce443..f3c4009eb1b 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1884,6 +1884,9 @@ class KeepSorted(ComplianceTest): # Ignore blank lines continue + if strip is not None: + line = line.strip(strip) + if regex: # check for regex if not re.match(regex, line): @@ -1892,9 +1895,6 @@ class KeepSorted(ComplianceTest): 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:]): @@ -1918,8 +1918,8 @@ class KeepSorted(ComplianceTest): 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