From 344c97f1e83e4992150a96c36649676f4ae0e625 Mon Sep 17 00:00:00 2001 From: Alex Overchenko Date: Mon, 29 Aug 2022 10:57:06 +0300 Subject: [PATCH] Passed files will be checked by exclude pattern too --- run-clang-format.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/run-clang-format.py b/run-clang-format.py index dcabaf1..04943e6 100755 --- a/run-clang-format.py +++ b/run-clang-format.py @@ -86,7 +86,15 @@ def list_files(files, recursive=False, extensions=None, exclude=None): if ext in extensions: out.append(f) else: - out.append(file) + isAddFile = True + + for pattern in exclude: + if fnmatch.fnmatch(file, pattern): + isAddFile = False + break + + if isAddFile: + out.append(file) return out @@ -130,7 +138,7 @@ def run_clang_format_diff(args, file): original = f.readlines() except IOError as exc: raise DiffError(str(exc)) - + if args.in_place: invocation = [args.clang_format_executable, '-i', file] else: