-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[run-clang-tidy.py] Add -directory-filter option to run-clang-tidy.py #89302
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
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 |
---|---|---|
|
@@ -307,6 +307,14 @@ def main(): | |
"source files from compilation database to output " | ||
"diagnostics from.", | ||
) | ||
parser.add_argument( | ||
"-directory-filter", | ||
dest="directory_filter", | ||
action="append", | ||
default=[], | ||
help="List of directories matching the names of the " | ||
"compilation database to filter.", | ||
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. filter in, or filter out ?
Comment on lines
+315
to
+316
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. use regexp instead of list of directories |
||
) | ||
parser.add_argument( | ||
"-line-filter", | ||
default=None, | ||
|
@@ -488,6 +496,7 @@ def main(): | |
|
||
# Build up a big regexy filter from all command line arguments. | ||
file_name_re = re.compile("|".join(args.files)) | ||
directory_filters_re = re.compile("|".join(args.directory_filters)) | ||
|
||
return_code = 0 | ||
try: | ||
|
@@ -514,7 +523,7 @@ def main(): | |
|
||
# Fill the queue with files. | ||
for name in files: | ||
if file_name_re.search(name): | ||
if file_name_re.search(name) and not directory_filters_re.search(name): | ||
Comment on lines
-517
to
+526
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. to be honest those lines should be handled like current filtering in line 491 |
||
task_queue.put(name) | ||
|
||
# Wait for all threads to be done. | ||
|
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.
this basically work opposite to -source-filter, specially because it work on full path, not just on directory path.
Therefore I could filter out with this an file also, not only directory.
For me this option is just an negative source-filter, and as you can do negative regexp in python, i do not see a reason for it.
Specially that for what this option describes there is already this: