summaryrefslogtreecommitdiffstats
path: root/lib/python/qmk/cli/cformat.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/python/qmk/cli/cformat.py')
-rw-r--r--lib/python/qmk/cli/cformat.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/python/qmk/cli/cformat.py b/lib/python/qmk/cli/cformat.py
index 0cd8b6192a..600161c5c5 100644
--- a/lib/python/qmk/cli/cformat.py
+++ b/lib/python/qmk/cli/cformat.py
@@ -4,7 +4,9 @@ import subprocess
from shutil import which
from milc import cli
-import qmk.path
+
+from qmk.path import normpath
+from qmk.c_parse import c_source_files
def cformat_run(files, all_files):
@@ -45,10 +47,10 @@ def cformat(cli):
ignores = ['tmk_core/protocol/usb_hid', 'quantum/template']
# Find the list of files to format
if cli.args.files:
- files.extend(qmk.path.normpath(file) for file in cli.args.files)
+ files.extend(normpath(file) for file in cli.args.files)
# If -a is specified
elif cli.args.all_files:
- all_files = qmk.path.c_source_files(core_dirs)
+ all_files = c_source_files(core_dirs)
# The following statement checks each file to see if the file path is in the ignored directories.
files.extend(file for file in all_files if not any(i in str(file) for i in ignores))
# No files specified & no -a flag
@@ -56,7 +58,7 @@ def cformat(cli):
base_args = ['git', 'diff', '--name-only', cli.args.base_branch]
out = subprocess.run(base_args + core_dirs, check=True, stdout=subprocess.PIPE)
changed_files = filter(None, out.stdout.decode('UTF-8').split('\n'))
- filtered_files = [qmk.path.normpath(file) for file in changed_files if not any(i in file for i in ignores)]
+ filtered_files = [normpath(file) for file in changed_files if not any(i in file for i in ignores)]
files.extend(file for file in filtered_files if file.exists() and file.suffix in ['.c', '.h', '.cpp'])
# Run clang-format on the files we've found