-
-
Notifications
You must be signed in to change notification settings - Fork 436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify how stars work in file patterns #1675
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -235,9 +235,24 @@ def globs_to_regex_params( | |
), | ||
globs_to_regex_params( | ||
["*/foo"], case_insensitive=False, partial=True, | ||
matches=["abc/foo/hi.py", "foo/hi.py"], | ||
matches=["abc/foo/hi.py", "foo/hi.py", "abc/def/foo/hi.py"], | ||
nomatches=["abc/xfoo/hi.py"], | ||
), | ||
globs_to_regex_params( | ||
["*c/foo"], case_insensitive=False, partial=True, | ||
matches=["abc/foo/hi.py"], | ||
nomatches=["abc/xfoo/hi.py", "foo/hi.py", "def/abc/foo/hi.py"], | ||
), | ||
globs_to_regex_params( | ||
["foo/x*"], case_insensitive=False, partial=True, | ||
matches=["foo/x", "foo/xhi.py", "foo/x/hi.py"], | ||
nomatches=[], | ||
), | ||
globs_to_regex_params( | ||
["foo/x*"], case_insensitive=False, partial=False, | ||
matches=["foo/x", "foo/xhi.py"], | ||
nomatches=["foo/x/hi.py"], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Even though, it's there in the source code, I forgot that this wouldn't match since some time has passed since I first opened my PR. So when I read the new explanation, I assumed this would match too. I think that adding more specific examples to the docs would really help to disambiguate them. |
||
), | ||
globs_to_regex_params( | ||
["**/foo"], | ||
matches=["foo", "hello/foo", "hi/there/foo"], | ||
|
@@ -348,6 +363,7 @@ def test_glob_matcher(self) -> None: | |
(self.make_file("sub/file1.py"), True), | ||
(self.make_file("sub/file2.c"), False), | ||
(self.make_file("sub2/file3.h"), True), | ||
(self.make_file("sub2/sub/file3.h"), True), | ||
(self.make_file("sub3/file4.py"), True), | ||
(self.make_file("sub3/file5.c"), False), | ||
] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this will also work:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wait, I see that a similar case is already in nomatches.. Let me reread the new doc explanation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't match. The next line includes
nomatches=["def/abc/foo/hi.py"]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I saw that after writing the comment.