diff options
Diffstat (limited to 'coverage')
-rw-r--r-- | coverage/files.py | 2 | ||||
-rw-r--r-- | coverage/misc.py | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/coverage/files.py b/coverage/files.py index 4475f2f1..87a18bc2 100644 --- a/coverage/files.py +++ b/coverage/files.py @@ -296,6 +296,8 @@ def fnmatches_to_regex(patterns, case_insensitive=False, partial=False): """ regexes = (fnmatch.translate(pattern) for pattern in patterns) + # */ at the start should also match nothing. + regexes = (re.sub(r"^\(\?s:\.\*(\\\\|/)", r"(?s:^(.*\1)?", regex) for regex in regexes) # Be agnostic: / can mean backslash or slash. regexes = (re.sub(r"/", r"[\\\\/]", regex) for regex in regexes) diff --git a/coverage/misc.py b/coverage/misc.py index e9b1b8eb..98a5d139 100644 --- a/coverage/misc.py +++ b/coverage/misc.py @@ -181,7 +181,7 @@ def bool_or_none(b): def join_regex(regexes): - """Combine a list of regexes into one that matches any of them.""" + """Combine a series of regexes into one that matches any of them.""" return "|".join(f"(?:{r})" for r in regexes) |