Skip to content

Commit b1f398d

Browse files
pdgendtcfriedt
authored andcommitted
scripts: ci: check_compliance: KeepSorted allow combining strip and re
No reason we couldn't strip a line we want to match to a regex. Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
1 parent 42640b1 commit b1f398d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

scripts/ci/check_compliance.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1884,6 +1884,9 @@ def _test_indent(txt: str):
18841884
# Ignore blank lines
18851885
continue
18861886

1887+
if strip is not None:
1888+
line = line.strip(strip)
1889+
18871890
if regex:
18881891
# check for regex
18891892
if not re.match(regex, line):
@@ -1892,9 +1895,6 @@ def _test_indent(txt: str):
18921895
if _test_indent(line):
18931896
continue
18941897

1895-
if strip is not None:
1896-
line = line.strip(strip)
1897-
18981898
if fold:
18991899
# Fold back indented lines after the current one
19001900
for cont in takewhile(_test_indent, lines[idx + 1:]):
@@ -1918,8 +1918,8 @@ def check_file(self, file, fp):
19181918

19191919
start_marker = f"{self.MARKER}-start"
19201920
stop_marker = f"{self.MARKER}-stop"
1921-
regex_marker = r"re\((.+)\)"
1922-
strip_marker = r"strip\((.+)\)"
1921+
regex_marker = r"re\(([^)]+)\)"
1922+
strip_marker = r"strip\(([^)]+)\)"
19231923
nofold_marker = "nofold"
19241924
start_line = 0
19251925
regex = None

0 commit comments

Comments
 (0)