Skip to content

Commit f8631e2

Browse files
committed
Fix regex, add comment explaining what does it do
1 parent b6611bb commit f8631e2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

codechecker_common/skiplist_handler.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,15 @@ def __gen_regex(self, skip_lines):
5252
"""
5353
for skip_line in skip_lines:
5454
norm_skip_path = os.path.normpath(skip_line[1:].strip())
55+
# fnmatch places a '\Z' at the end, this is equivalent to '$'
56+
# (end of input) so it must be removed.
57+
# Optionally we match the user given path with a '/.*' ending.
58+
# This, if the given input is a folder will
59+
# resolve all files contained within.
60+
# Note: normalization removes '/' from the end, see:
61+
# https://docs.python.org/3/library/os.path.html#os.path.normpath
5562
rexpr = re.compile(
56-
fnmatch.translate(norm_skip_path) + r"(?:\/.*)?")
63+
fnmatch.translate(norm_skip_path)[:-2] + r"(?:/.*)?\Z")
5764
self.__skip.append((skip_line, rexpr))
5865

5966
def __check_line_format(self, skip_lines):

0 commit comments

Comments
 (0)