Align cformat rules with current CI implementation (#7936)
* Align cformat rules with current CI implementation * Optimise file walking
This commit is contained in:
parent
bf4611c7b7
commit
8e500c3670
1 changed files with 4 additions and 3 deletions
|
@ -24,13 +24,14 @@ def cformat(cli):
|
||||||
if cli.args.files:
|
if cli.args.files:
|
||||||
cli.args.files = [os.path.join(os.environ['ORIG_CWD'], file) for file in cli.args.files]
|
cli.args.files = [os.path.join(os.environ['ORIG_CWD'], file) for file in cli.args.files]
|
||||||
else:
|
else:
|
||||||
|
ignores = ['tmk_core/protocol/usb_hid', 'quantum/template']
|
||||||
for dir in ['drivers', 'quantum', 'tests', 'tmk_core']:
|
for dir in ['drivers', 'quantum', 'tests', 'tmk_core']:
|
||||||
for dirpath, dirnames, filenames in os.walk(dir):
|
for dirpath, dirnames, filenames in os.walk(dir):
|
||||||
if 'tmk_core/protocol/usb_hid' in dirpath:
|
if any(i in dirpath for i in ignores):
|
||||||
continue
|
dirnames.clear()
|
||||||
|
|
||||||
for name in filenames:
|
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))
|
cli.args.files.append(os.path.join(dirpath, name))
|
||||||
|
|
||||||
# Run clang-format on the files we've found
|
# Run clang-format on the files we've found
|
||||||
|
|
Loading…
Reference in a new issue