summaryrefslogtreecommitdiff
path: root/lib/python/qmk/cli/cformat.py
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2020-01-22 02:21:14 +0000
committerFlorian Didron <fdidron@users.noreply.github.com>2020-02-26 10:15:12 +0900
commit72c5e4958cb136d1bda37c2369f71f8a1a6071ad (patch)
tree36b34c4d1e98bdae8dba4733f52d9dcf936bc0ce /lib/python/qmk/cli/cformat.py
parent97038602f5868fc851322d1edb9822fe1b652f3f (diff)
Align cformat rules with current CI implementation (#7936)
* Align cformat rules with current CI implementation * Optimise file walking
Diffstat (limited to 'lib/python/qmk/cli/cformat.py')
-rw-r--r--lib/python/qmk/cli/cformat.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/python/qmk/cli/cformat.py b/lib/python/qmk/cli/cformat.py
index 17ca91b3b5..fe1edef60b 100644
--- a/lib/python/qmk/cli/cformat.py
+++ b/lib/python/qmk/cli/cformat.py
@@ -24,13 +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):
- if 'tmk_core/protocol/usb_hid' in dirpath:
- continue
+ if any(i in dirpath for i in ignores):
+ 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