-
-
Notifications
You must be signed in to change notification settings - Fork 595
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
Support exclusion file filters #826
base: master
Are you sure you want to change the base?
Conversation
srikary12
commented
Jun 19, 2024
- Closes [IDEA] Support exclusion file filters #728
- Adds file filter similar to word filters
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.
Hey @srikary12, just left 1 comment (to add tests) but otherwise changes look good! Excited to get file filters to word filter parity
@debanjum Can you check and let me know if it's working fine. |
This reverts commit f0bb8fa.
…to file-exclusion
file filter test cases
@debanjum @sabaimran let me know if there are any issues |
@debanjum added the case |
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.
Thanks for the working through the feedback! I've left some comments to fix the unit tests. Maybe a good idea to manually validate these changes locally and/or run the unit tests on your machine with pytest
. It'll speed up the review cycle
def test_exclude_file_filter_terms(): | ||
# Arrange | ||
file_filter = FileFilter() | ||
q_with_filter_terms = 'head tail file:-"file 1.org" file:"/path/to/dir/*.org"' |
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.
Shouldn't the tested query be something like below?
q_with_filter_terms = 'head tail file:-"file 1.org" file:"/path/to/dir/*.org"' | |
q_with_filter_terms = 'head tail -file:"file 1.org" file:"/path/to/dir/*.org"' |
def test_file_exclude_filter(): | ||
# Arrange | ||
file_filter = FileFilter() | ||
q_with_exclude_filter = 'head -"exclude_file" tail' |
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.
The query tested seems to be for word filters instead of file filters. Wouldn't the query with file filter be of the form:
q_with_exclude_filter = 'head -"exclude_file" tail' | |
q_with_exclude_filter = 'head -file:"/path/to/excluded_file" tail' |
def test_file_include_and_exclude_filter(): | ||
# Arrange | ||
file_filter = FileFilter() | ||
q_with_include_and_exclude_filter = 'head "include_file" -"exclude_file" tail' |
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.
The query tested seems to be for word filters instead of file filters. Wouldn't the query with file filter be of the form:
q_with_include_and_exclude_filter = 'head "include_file" -"exclude_file" tail' | |
q_with_include_and_exclude_filter = 'head file:"include_file" -file:"exclude_file" tail' |
@@ -87,6 +87,42 @@ def test_get_file_filter_terms(): | |||
assert filter_terms == ["file 1\\.org", "/path/to/dir/.*\\.org"] | |||
|
|||
|
|||
def test_exclude_file_filter_terms(): |
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.
A more appropriate name for this unit test maybe test_include_and_exclude_file_filter_terms
def test_exclude_file_filter_terms(): | |
def test_include_and_exclude_file_filter_terms(): |
Sure, I'll be working on it. Thanks. |