From c6e60a53ac27161709686b41d5e21546d0dfcceb Mon Sep 17 00:00:00 2001 From: Akira KAWAGUCHI Date: Mon, 18 Sep 2023 12:24:30 +0900 Subject: [PATCH] Update run-clang-tidy.sh From: https://github.com/project-tsurugi/mizugaki/pull/23 --- tools/bin/run-clang-tidy.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/bin/run-clang-tidy.py b/tools/bin/run-clang-tidy.py index 0682b6a..a637d53 100644 --- a/tools/bin/run-clang-tidy.py +++ b/tools/bin/run-clang-tidy.py @@ -223,6 +223,9 @@ def main(): 'command line.') parser.add_argument('-quiet', action='store_true', help='Run clang-tidy in quiet mode') + parser.add_argument('-exclude', + action='append', default=[], + help='excluding target files (regex on path)') args = parser.parse_args() db_path = 'compile_commands.json' @@ -261,6 +264,11 @@ def main(): # Build up a big regexy filter from all command line arguments. file_name_re = re.compile('|'.join(args.files)) + if args.exclude: + exclude_name_re = re.compile('|'.join(args.exclude)) + else: + exclude_name_re = re.compile('^$') # never much to any paths + return_code = 0 try: # Spin up a bunch of tidy-launching threads. @@ -276,7 +284,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 exclude_name_re.search(name): task_queue.put(name) # Wait for all threads to be done.