Skip to content

Commit

Permalink
Optimise file walking
Browse files Browse the repository at this point in the history
  • Loading branch information
zvecr committed Jan 19, 2020
1 parent e267bc5 commit 7b97f2d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/python/qmk/cli/cformat.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ def cformat(cli):
if cli.args.files:
cli.args.files = [os.path.join(os.environ['ORIG_CWD'], file) for file in cli.args.files]
else:
ignores = ['tmk_core/protocol/usb_hid', 'quantum/template']
for dir in ['drivers', 'quantum', 'tests', 'tmk_core']:
for dirpath, dirnames, filenames in os.walk(dir):
ignores = ['tmk_core/protocol/usb_hid', 'quantum/template']
if any(i in dirpath for i in ignores):
continue
dirnames.clear()

for name in filenames:
if name.endswith('.c') or name.endswith('.h') or name.endswith('.cpp'):
if name.endswith(('.c', '.h', '.cpp')):
cli.args.files.append(os.path.join(dirpath, name))

# Run clang-format on the files we've found
Expand Down

0 comments on commit 7b97f2d

Please sign in to comment.