Skip to content
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

Passed files will be checked by exclude pattern too #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions run-clang-format.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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:
Expand Down