From 5288767abf18d9109b0e821f7e70a9f9c234d67c Mon Sep 17 00:00:00 2001 From: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com> Date: Thu, 4 Jun 2026 17:58:22 -0400 Subject: [PATCH] [clang-tidy] Add --exclude-grep to skip files by content (#16813) --- script/clang-tidy | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/script/clang-tidy b/script/clang-tidy index 47f59e62a4..633b8d4b7d 100755 --- a/script/clang-tidy +++ b/script/clang-tidy @@ -247,6 +247,12 @@ def main(): action="append", help="only run on files containing value", ) + parser.add_argument( + "-x", + "--exclude-grep", + action="append", + help="skip files containing value", + ) parser.add_argument( "--split-num", type=int, help="split the files into X jobs.", default=None ) @@ -281,6 +287,10 @@ def main(): if args.grep: files = filter_grep(files, args.grep) + if args.exclude_grep: + excluded = set(filter_grep(files, args.exclude_grep)) + files = [f for f in files if f not in excluded] + files.sort() if args.split_num: